如何使用Excel中包含的先前数据预测Python中的变量?
我有一种在Python执行的特定算法。 该算法使用3个变量:x
,y
和z
。 这些变量会影响执行算法所需的时间。 我使用Python将数据写入Excel工作表(使用OpenPyXL) 这是一个外观的示例:
x | y | z | 时间秒为秒 |
---|---|---|---|
1200 | 15000 | 1500 | 800 |
900 900 | 20000 | 1800 | 900 |
1300 | 20000 | 1800 | 1100 |
我想在python上打印,在执行前执行算法所需的估计时间用户知道他必须等待多长时间。
编辑以进行澄清:我想预测给定X,Y和Z的所需时间。
我该怎么做? 我可以在Excel中进行,并在Python中阅读价值吗? 还是有办法在python中做到这一点?
我正在寻找一种简单而紧凑的解决方案,可提供不错的结果,而不是一个复杂的解决方案,可提供非常准确的结果。
编辑:我是不是寻找书面并准备实现解决方案。方法的名称或仅仅是开始搜索的地方会很好,因为我以前从未做过。
I have a specific algorithm I execute in Python.
This algorithm uses 3 variables: x
, y
and z
.
These variables affect the time needed to execute the algorithm.
I used Python to write the data to an excel worksheet (using openpyxl)
This is an example of how it looks like:
x | y | z | time in seconds |
---|---|---|---|
1200 | 15000 | 1500 | 800 |
900 | 20000 | 1800 | 900 |
1300 | 20000 | 1800 | 1100 |
I would like to print, in Python, the estimated time needed to execute the algorithm before execution, so the user knows how long he has to wait.
Edit for clarification: I would like to predict the needed time from a given x, y and z.
How can I do this?
Can I do it in excel, and read the value in Python?
Or is there a way to do it in Python?
I am looking for a simple and compact solution that delivers decent results, rather than a complicated solution that delivers very accurate results.
Edit: I am not looking for a written and ready to implement solution. A name of a method or just a place to start searching would be nice as I have never done this before.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在您发布的特定表上,
但是每个CPU都有不同的速度,因此每个用户的时间都不同,您将需要在用户的计算机上运行基准标准。
您似乎已经运行了3个基准。如果您有更多,那么您将拥有比未知数更多的方程
On the specific table you posted,
But each CPU has different speeds, so the time would be different for each user, and you will need to run a benchmark on the user's computer.
You appear to have run 3 benchmarks. If you have more, then you will have more equations than unknowns, so you would need to do a multivariate linear regression to get a relationship between x,y,z and time