[SciPy-User] multidimensional polynomial fit
Oscar Gerardo Lazo Arjona
Sun Jun 13 00:28:28 CDT 2010
<josef.pktd <at> gmail.com> writes:
> Assuming I understand correctly, fitting the last variable to a
> polynomial of the first three
> depends on how many cross terms you want.
Well, I already wrote a generalized function that works like polyfit:
It returns an array of the coefficients of the multidimensional polynomial with
the degrees indicated as a list of integers (just as polyfit).
It was quite a lot of work, it's probably the most abstract thing I've done. I
had lot's of fun writing it, and I would like it to be included in numpy (if you
think that is wise).
> here is an example which restricts the powers in the cross-terms
> >>> x = np.arange(5)[:,None]+ [0,10,100]
> use of OLS can be replaced by np.linalg.lstsq
Well, thank you, but that's a lot more complicated to remember ;)
More information about the SciPy-User