Polynomial Regression is a form of linear regression model but fits a non-linear relationship between the value X and Y. Basically we have to add new features to the final equation. But what features? It’s simple we can add the X1 feature as new feature: X1^2 or X1^3. If we have some input features (X1,X2,X3) also we can add new features as X1*X2 or X1^2*X3^2. So, the polynomial regression model is:

As you can see in the following figure you can get a linear regression (red line) or you can get a non-linear regression (blue and  yellow) if you add more features to your equation. The type of curve of non-linear regression model depends of the grade of your polynomial. If the grade of the polynomial is near 1 the model fits to traditional linear regression model. Instead, if the grade of the polynomial is high the model fits to training points.

polynomial1

OverFitting is the term that it’s used to describe when your linear regression model don’t have capacity to predict because the model fits very near of the training points. This fact can happen if the model is very complex or the grade of equation is high. You notice that over-fitting is bad for your model and you should avoid it because the predictions will be very similar or equals to the training points.

polynomial2

You can play in live with this concept about polynomial regression in the following link: http://www.arachnoid.com/polysolve/index.html

Also you can get the source code of this example from my GIT repository.

facebooktwittergoogle_pluslinkedinmailby feather

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts

arduino

WorldTripLogger working!!

We tried the WorldTripLogger one day before MrHicks46 began his world trip on his motorcycle. We have noticed that the vibrations will be a little bit of a problem because some pictures have some wrong lines Read more…

android

Show your RTSP video in Android with VLC

If you have developed an Android app with video streaming, I’m sure you notice that Android use a pre-load of video buffer that fills in 10 seconds. This delay is hardcode in the source code. Read more…

android

Making screencast for Android classes

I need to record some screencast with audio for my online classes of Android. It’s a good way to explain all the topics about programming and android development. Slides, exercises, moodle and screencast is a Read more…