简体   繁体   English

python 中结合的线性和非线性回归

[英]linear and nonlinear regression combined in python

I am working on data set where there are four predictors.我正在研究有四个预测变量的数据集。 There is good linear relation with one of the predictors but with other three i think polynomial would fit.与预测变量之一存在良好的线性关系,但与其他三个我认为多项式适合。 Is there any method in python where i can predict single variable combining linear regression on one predictors and polynomial or other non-linear regression on other three predictors? python 中是否有任何方法可以预测单个变量,将一个预测变量的线性回归和其他三个预测变量的多项式或其他非线性回归相结合?

Please help.请帮忙。

You can fit one polynomial expression for all features which should take care of the linear one as well.您可以为所有应该考虑线性的特征拟合一个多项式表达式。 The only difference is that the coefficient of the linear one will be of order 1.唯一的区别是线性系数的系数为 1。

You could try np.polyfit to see a potential trend in your data.您可以尝试 np.polyfit 来查看数据中的潜在趋势。 Documentation: https://numpy.org/doc/stable/reference/generated/numpy.polyfit.html文档: https://numpy.org/doc/stable/reference/generated/numpy.polyfit.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM