Skip to content

This program implements linear regression with polynomial features using the sklearn library in Python. The program uses a training set of data and plots a prediction using the Linear Regression model.

Notifications You must be signed in to change notification settings

chop-dev/polynomial-regression

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Linear Regression with Polynomial Features

This program implements linear regression with polynomial features using the sklearn library in Python. The program uses a training set of data and plots a prediction using the Linear Regression model.

Requirements

The following libraries are required to run the program:

  • Python
  • numpy
  • matplotlib
  • sklearn

Data

The program uses two sets of data for bluegill fish - training set and testing set.

  • The training set consists of 10 data points with age of bluegill in years and its corresponding length in millimeters.
  • The testing set consists of 10 data points with age of bluegill in years and its corresponding length in millimeters.

Functionality

The program performs the following operations:

  1. Trains a Linear Regression model using the training set data.
  2. Sets the degree of the polynomial regression model.
  3. Transforms the input data matrix into a new data matrix of a given degree using the PolynomialFeatures preprocessor.
  4. Trains and tests the polynomial regression model.
  5. Plots a graph of the training data and the prediction using the linear and polynomial regression models.

Conclusion

This program demonstrates the use of polynomial features in linear regression using the sklearn library. The program trains and tests the polynomial regression model and plots a graph to visualize the results.

About

This program implements linear regression with polynomial features using the sklearn library in Python. The program uses a training set of data and plots a prediction using the Linear Regression model.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages