The following example explains how to do it using the numpy.vander function:
http://scikit-learn.org/stable/auto_examples/linear_model/plot_polynomial_interpolation.html
Mathieu
On Wed, Aug 8, 2012 at 11:27 AM, Zach Bastick <[email protected]>wrote:
> How can you increase the degree of the polynomial for multivariate
> LinearRegression?
> Numpy.polyfit has a "deg" parameter, allowing you to choose the degree
> of the fitting polynomial, but doesn't work with multivariate data:
> http://docs.scipy.org/doc/numpy/reference/generated/numpy.polyfit.html
>
> For example, a 2nd degree polynomial fit would have the following
> regression equation:
> y = intercept + (b*x1 +b* x1^2) + (b*x2 + b*x2^2) + (b*x3 + b*x3^2)
>
> The following only does 1st degree polynomial fit:
>
> clf = linear_model.LinearRegression()
> clf.fit(x,y)
> regress_coefs = clf.coef_
> regress_intercept = clf.intercept_
>
> So how can you do higher degree polynomial fits? This should allow me to
> getting a better fitting curve to get a prediction/regression formula
> for my machine learning project.
>
> Thanks,
>
> Zach
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Scikit-learn-general mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general