Python中的多元非线性回归

时间:2020-02-01 13:06:33

标签: python pandas statistics regression non-linear-regression

我正在寻找可以帮助我找到回归方程的任何库或方法。等式采用以下格式:

Y = a1 * x ^ a + a2 * y ^ b + a3 * z ^ c + D

其中:

  • Y是因变量
  • x,y,z是自变量
  • D是常数
  • a1,a2,a3是系数
  • a,b,c分别是自变量的指数。

我将Y和x,y,z值存储在数据帧中。

1 个答案:

答案 0 :(得分:1)

您可以使用scikit learning中的Random Forest Regressor实现。它很容易使用,只需执行以下操作即可:

from sklearn.ensemble import RandomForestRegressor
clf = RandomForestRegressor()

# train the model
clf.fit(df[['x','y','z']], df['Y'])

# predict on test data
predict = clf.predict(test_data[['x','y','z']])

确保训练和测试数据具有相同数量的自变量。

有关更多非线性回归器,请检查:scikit-learn ensemble module