Python或SQL Logistic回归 [英] Python or SQL Logistic Regression
问题描述
鉴于时间序列数据,我想找到最合适的对数曲线.在Python或SQL中有什么好的库可以做到这一点?
Given time-series data, I want to find the best fitting logarithmic curve. What are good libraries for doing this in either Python or SQL?
具体来说,我正在寻找的是一个可以容纳类似于S形函数的数据的库,该库具有上下水平渐近线.
Specifically, what I'm looking for is a library that can fit data resembling a sigmoid function, with upper and lower horizontal asymptotes.
推荐答案
如果您的数据是分类的,则可以使用逻辑回归来拟合属于某个类(分类)的概率.
If your data were categorical, then you could use a logistic regression to fit the probabilities of belonging to a class (classification).
但是,我了解到您正在尝试将数据拟合为S形曲线,这意味着您只想最小化拟合的均方误差.
However, I understand you are trying to fit the data to a sigmoid curve, which means you just want to minimize the mean squared error of the fit.
我会将您重定向到名为scipy.optimize.leastsq
的 SciPy 函数:执行最小二乘拟合.
I would redirect you to the SciPy function called scipy.optimize.leastsq
: it is used to perform least squares fits.
这篇关于Python或SQL Logistic回归的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!