Skip to content

Polynomial Regression: The code shows examples of machine learning linear and polynomial predictive models, constructed in a loop such that the user can determine the best model for the data.

License

Notifications You must be signed in to change notification settings

T3kan0/Polynomial_Regression

Repository files navigation

Polynomial_Regression

Tekano Mbonani

System Docs 📃

This is an example of the supervised Machine Learning algorithms/techniques often used to model relationships between features and labels. In this code, I show examples of linear regression, as well as Polynomial regression, and compare the different models.

Software Requirements 🔌

You will need to install the following software on your system in order to run/edit the Python script.

  • Mac OS/ Ubuntu 18.04 OS
  • Python 3.10.12
  • Textedit/ IDE - spyder or jupyter-notebook
  • Python libraries
    • Numpy
    • Matplotlib
    • Sklearn
    • PIL
    • glob

About the Data 💾

The data used here was generated randomly with the numpy python library. The data is meant to only help us see how the different Polynomial orders can fit the data. For us to see things to avoid when fitting the data, such as overfitting when the order of the polynomial function gets high. In this case, the data was best fit with a polynomial function of the first order, i.e., Linear.

Profile Model 🧮

The code employs supervised machine learning from the library sklearn for the analysis. The data is split into trainig and testing data, then the model is trained with the said training data, before it can be fit to the test data. Similar to many other models, the training data was 80% of the overall data, while the 20% was used to test the data.

Code Output 📈

For every polynomial function fitted, in order to know determine the goodness of the model fit, I calculated the regression determination coefficient. The data was best described by a sixth order polynomial. See the figure below.

Material Bread logo

About

Polynomial Regression: The code shows examples of machine learning linear and polynomial predictive models, constructed in a loop such that the user can determine the best model for the data.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages