2

Is there a way to carry out polynomial regression $x + x^2$ in H2O (Python)? What I have found about this is "interactions" option in GLM. However, I am not sure if this option yields polynomial regression as given here (link).

Maxim
  • 3,164
  • 1
  • 17
  • 25
mlee_jordan
  • 209
  • 1
  • 2
  • 10

1 Answers1

4

If you are willing to manually do the basis expansion, any package supports linear regression will support polynomial expansion.

When I say manual basis expansion I mean to create additional columns to your data. Suppose you have three data points are $x_1,x_2,x_3$, and the design matrix is

$$ \begin{bmatrix} 1&\ x_1 & x_1^2 \\ 1& x_2 & x_2^2\\ 1 &\ x_3 &x_3^2\end{bmatrix} $$

You can find more examples of the basis expansion here.

What's wrong to fit periodic data with polynomials?

PS: what I suggested is called raw polynomials, which is not a good idea from numerical stability view. Orthogonal polynomial would be much better, and details can be found in my answer here

Haitao Du
  • 32,885
  • 17
  • 118
  • 213