是否可以计算Sklearn中线性和多项式回归模型的置信区间?
我正在使用Sklearn -linear和多项式回归模型进行一些基本的预测。我能够使我的模型启动并很快运行以做出预测,但是我也想计算80%的置信区间,以获得上下界限以及预测。
是否有一种简单的方法可以使用内置的Sklearn功能来计算这些数字?
这是我的数据df
的样子:
+------------+------+
| date | cost |
+------------+------+
| 01/01/2022 | 100 |
| 02/01/2022 | 104 |
| 03/01/2022 | 107 |
| 04/01/2022 | 108 |
| 05/01/2022 | 111 |
| 06/01/2022 | 117 |
| 07/01/2022 | 120 |
| 08/01/2022 | 122 |
| 09/01/2022 | 128 |
| 10/01/2022 | 133 |
+------------+------+
对于这两个模型和接下来的10天,我想计算yhat
,yhat_lower
,和yhat_upper
,但我不确定这样做的最佳方法。任何帮助将不胜感激!
I am doing some basic forecasting using the sklearn linear and polynomial regression models. I am able to get my model up and running pretty quickly to make predictions, but I also would like to calculate the 80% confidence intervals to get the upper and lower bounds along with the predictions.
Is there an easy way to calculate those numbers using inbuilt sklearn features?
here is what my data df
looks like:
+------------+------+
| date | cost |
+------------+------+
| 01/01/2022 | 100 |
| 02/01/2022 | 104 |
| 03/01/2022 | 107 |
| 04/01/2022 | 108 |
| 05/01/2022 | 111 |
| 06/01/2022 | 117 |
| 07/01/2022 | 120 |
| 08/01/2022 | 122 |
| 09/01/2022 | 128 |
| 10/01/2022 | 133 |
+------------+------+
For both models and for the next 10 days for example, I want to calculate yhat
, yhat_lower
, and yhat_upper
, but I am not sure on the best way to do this. Any help would be appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)