Hi Michael, as you point out I also think the most straight forward
approach (good enough) is to fit all the polynomials (n = 0,..,3) using
ols, and evaluate the predictive capability by cross-validation. Will
compare this to the lasso approach.
Thanks for your comments!
-fernando
On Sun, Jun 2
The model selection properties of the lasso are such that it will select a
certain number of variables that suit it best. If you like, you can run a
lasso and then select the degree of the polynomial of maximum degree active
and call it the polynomial order of your problem.
I maintain that the set
Note2: In summary, I want the coefficients a_i without having to pre-define
neither the degree of the polynomial to fit (n) nor the amount of
regularization to apply (alpha), and always preferring the simpler model
(less coefficients).
-fernando
On Sun, Jun 29, 2014 at 6:52 PM, Fernando Paolo
Michael and Mathieu, thanks for your answers!
Perhaps I should explain better my problem, so you may have a better
suggestion on how to approach it. I have several datasets of the form f =
y(x), and I need to fit to these data a 'linear', 'quadratic' or 'cubic'
polynomial. So I want to (i) *automa
Hi Fernando,
On Sun, Jun 29, 2014 at 1:53 PM, Fernando Paolo wrote:
> Hello,
>
> I must be missing something obvious because I can't find the "actual"
> coefficients of the polynomial fitted using LassoCV. That is, for a 3rd
> degree polynomial
>
> p = a0 + a1 * x + a2 * x^2 + a3 * x^3
>
> I w
Running your code and then plotting
plt.plot(x, lasso_predict)
plt.plot(x, y)
shows a pretty good correspondence (r^2 = .97)!
I think the problem is that Xpoly does not contain raw polynomials as you
use for prediction.
If you do
p_lasso = a[0] + a[1] * Xpoly[:, 1] + a[2] * Xpoly[:, 2] + a[3]
Hello,
I must be missing something obvious because I can't find the "actual"
coefficients of the polynomial fitted using LassoCV. That is, for a 3rd
degree polynomial
p = a0 + a1 * x + a2 * x^2 + a3 * x^3
I want the a0, a1, a2 and a3 coefficients (as those returned by
numpy.polyfit()). Here is