2024-09-28 20:50:47 发布
网友
对于线性模型,Python等价于R predict函数是什么?在
我相信scipy中有一些东西可以帮到你,但是有没有一个等效的函数呢?在
https://stat.ethz.ch/R-manual/R-patched/library/stats/html/predict.lm.html
Scipy有大量的带有预测方法的回归工具;尽管IMO,Pandas是最接近复制R功能的python库,并带有预测方法。下面的R和python代码片段展示了它们的相似之处。在
R线性回归:
data(trees) linmodel <- lm(Volume~., data = trees[1:20,]) linpred <- predict(linmodel, trees[21:31,]) plot(linpred, trees$Volume[21:31])
python中使用pandasols的相同数据集:
ols
Scipy有大量的带有预测方法的回归工具;尽管IMO,Pandas是最接近复制R功能的python库,并带有预测方法。下面的R和python代码片段展示了它们的相似之处。在
R线性回归:
python中使用pandas
^{pr2}$ols
的相同数据集:相关问题 更多 >
编程相关推荐