I have many samples (y_i, (a_i, b_i, c_i))
where y
is presumed to vary as a polynomial in a,b,c
up to a certain degree. For example for a given set of data and degree 2 I might produce the model
y = a^2 + 2ab - 3cb + c^2 +.5ac
This can be done using least squares and is a slight extension of numpy's polyfit routine. Is there a standard implementation somewhere in the Python ecosystem?
Best Answer
sklearn provides a simple way to do this.
Building off an example posted here:
And heres the output: