Posts

Showing posts with the label Polynomial

Machine Learning Series: Polynomial Regression

Image
  Hello Reader,   In a previous post I described the  linear regression , the algorithm works well when the features are linearly correlated but what if the data cannot be described with a straight line? Surprisingly it is possible to use Linear Regression also in these cases, simply adding new features as power of existing features and run the linear regression on this new set. This technique is called Polynomial Regression.   Let's get create some synthetic data using SIN and some added noise Now I proceed to split the dataset in train and test sets And let's train linear regression Let's evaluate the model using MSE Here we can see how linear regression is trying to do its best to predict the test instances We can definitely do better, let's calculate new polynomial features using Sklearn library As you can see I have configured the  PolynomialFeatures  library to generate the 8-degree polynomial features it means that the algorithm is generating all com...