I have multiple vaiables and a list of experimental results, and Im wondering what will be the best way to create a polinomial fitting function.
ex :
| param1 | param2 | param3| res|
|--------------------------------|
|0.5 | 0.004 | 40 |6.75|
|0.55 | 0.684 | 0 |10.1|
|0.6 | 0.001 | -40 |13.2|
...
so far I used python to find the polinomial regsression like so:
import numpy as np
x = np.array([[0.5 ,0.004 ,40],[0.55, 0.684, 0],[0.6, 0.001, -40]...more parameters values ..]) # matrix describing all parameters
z = [6.75, 10.1, 13.2, ....more results....] # vector to describe all results according to parameters
degrees = [(i, j, k) for i in range(3) for j in range(3) for k in range(3)] # list of monomials x**i * y**j to use
matrix = np.stack([np.prod(x**d, axis=1) for d in degrees], axis=-1) # stack monomials like columns
coeff = np.linalg.lstsq(matrix, z)[0] # lstsq returns some additional info we ignore
fit = np.dot(matrix, coeff)
as suggested by #user6655984 here: How can I use multiple dimensional polynomials with numpy.polynomial?
Now im trying to understand how to measure the accuracy? and to determine the max degree of each variable of the polynom.