python多元非线性回归模型_Python中多维数据样本的非线性回归

试试像这样的

编辑:添加了一个使用线性回归结果估计输出的示例函数。import numpy as np

data =np.array(

[[-0.042780748663101636, -0.0040771571786609945, -0.00506567946276074],

[0.042780748663101636, -0.0044771571786609945, -0.10506567946276074],

[0.542780748663101636, -0.005771571786609945, 0.30506567946276074],

[-0.342780748663101636, -0.0304077157178660995, 0.90506567946276074]])

coefficient = data[:,0:2]

dependent = data[:,-1]

x,residuals,rank,s = np.linalg.lstsq(coefficient,dependent)

def f(x,u,v):

return u*x[0] + v*x[1]

for datum in data:

print f(x,*datum[0:2])

它给予>>> x

array([ 0.16991146, -30.18923739])

>>> residuals

array([ 0.07941146])

>>> rank

2

>>> s

array([ 0.64490113, 0.02944663])

用你的系数创建的函数0.115817326583

0.14

你可能感兴趣的:(python多元非线性回归模型)