Python:为数据列表找到最适合的函数(Python: Find a best fit function for a list of data)

编程入门 行业动态 更新时间:2024-10-26 14:38:28
Python:为数据列表找到最适合的函数(Python: Find a best fit function for a list of data)

我知道许多概率函数在python中构建, random模块。

我想知道,如果给出浮标列表,是否有可能找到最适合列表的分布方程式?

我不知道numpy是否会这样做,但是这个函数可以与Excel的“趋势”函数进行比较(不相等,但相似)。

我会怎么做?

I am aware of many probabilistic functions builted-in python, with the random module.

I'd like to know if, given a list of floats, would be possible to find the distribution equation that best fits the list?

I don't know if numpy does it, but this function could be compared (not equal, but similar) with the Excel's "Trend" function.

How would I do that?

最满意答案

看看numpy.polyfit

numpy.polyfit(x, y, deg, rcond=None, full=False)¶ Least squares polynomial fit. Fit a polynomial p(x) = p[0] * x**deg + ... + p[deg] of degree deg to points (x, y). Returns a vector of coefficients p that minimises the squared error.

Look at numpy.polyfit

numpy.polyfit(x, y, deg, rcond=None, full=False)¶ Least squares polynomial fit. Fit a polynomial p(x) = p[0] * x**deg + ... + p[deg] of degree deg to points (x, y). Returns a vector of coefficients p that minimises the squared error.

更多推荐

本文发布于:2023-08-05 18:02:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1437370.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:最适合   函数   数据   列表   Python

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!