Python 中的数据建模/预测?

发布于 2024-10-24 12:11:50 字数 653 浏览 4 评论 0原文

我该如何解决我想到的这个问题?我什至不知道在 Python 中是否可行,但无论如何。基本上,我想给 Python 一些数据来查找数据中的模式,然后显示最可能的结果。我认为零用钱是一个很好的例子:

A 每周获得 7 美元,每天 1 美元,他周末花费 5 美元,周一的余额为 2 美元 + 1 美元(每周 7 美元,每天 1 美元) )。这种情况持续三周。 A 在第四周会得到什么?

Balance in account:  
week1 = 1,2,3,4,5,6,7  
week2 = 3,4,5,6,7,8,9  
week3 = 5,6,7,8,9,10,11  
week4 = ??????????  

现在,我想知道是否可以创建一个模型,而不是基础数学,该模型可以查找模式,然后使用现有数据和模式创建数据。因此,脚本应该能够看到 A 每周获得 7 美元,而他每周损失 5 美元。这可能吗?

该模型是否可以灵活,如果我给它相同性质的其他数据,它能够找到模式吗?

(我使用的是 Python 3.2。)

How do I go about this problem I've thought up? I don't even know if it's possible in Python, but anyway. Basically, I want to give Python some data to look for patterns in the data and then display the most likely result. I thought pocket money would make a good example:

A gets $7 a week, a dollar a day, he spends $5 at the weekend and his balance on Monday is $2 + $1 ($7 a week 1 a day). This continues for three weeks. What will A get on the forth week?

Balance in account:  
week1 = 1,2,3,4,5,6,7  
week2 = 3,4,5,6,7,8,9  
week3 = 5,6,7,8,9,10,11  
week4 = ??????????  

Now, instead of basic math I was wondering if it was possible to create a model, one that looks for patterns and then creates the data using the existing data and the patterns. So the script should be able to see that A gets $7 a week and he loses $5 a week. Is this possible?

Is the model possible to be flexible as in if I give it other data of the same nature, will it be able to find patterns?

(I'm using Python 3.2.)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

贪了杯 2024-10-31 12:11:50

您所描述的问题属于回归问题。有了这个术语,您应该能够在网上和书籍中找到大量信息。

为了给您指明正确的方向,我建议研究“线性回归”,也许转向更复杂的回归模型,例如“随机森林回归器”。

“scikit-learn”Python 包有许多不同的回归模型,并且文档非常好。

What you're describing is classified as a regression problem. Armed with this term, you should be able to find lots of information online and in books.

To point you in the right direction, I'd suggest investigating "linear regression" and perhaps moving on to a more complex regression model like the "random forests regressor".

The "scikit-learn" Python package has a number of different regression models and the documentation is excellent.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文