[Python] Fit multi- variables polynomial model with Python [closed]

Discussão em 'Python' iniciado por Stack, Dezembro 8, 2024.

  1. Stack

    Stack Membro Participativo

    How can I use python packages to fit a polynomial model that connects between data set x:

    xa1 xb1 xc1
    xa2 xb2 xc2
    ...
    .
    .


    to a data set y:

    ya1 yb1 yc1
    ya2 yb2 yc2
    ...
    .
    .
    .


    I am trying to fit a second degree polynomial with a,b,c features: y=f(a,a^2,b,b^2,c,c^2,ab,ac,bc) by using coefficients=np.linalg.lstsq(A,y)[0]. However I am not sure how to build the matrix A. I understand it should be composed of len(x) rows, 10 columns, and should yield 10 coefficients. is there a known method to build this matrix?

    Continue reading...

Compartilhe esta Página