【问题标题】:exponential decay regression model in pythonpython中的指数衰减回归模型
【发布时间】:2021-06-24 20:19:12
【问题描述】:

我刚开始学习 sklearn 模块,一直在导入数据并找到线性回归模型并使用它来预测更多值。

我现在正试图找出发动机排量与 mpg 之间的关系。但是当我绘制它时,它看起来更像是指数衰减;我如何找到该图的回归模型Graph of engine displacement and mpg

【问题讨论】:

标签: python machine-learning scipy non-linear-regression


【解决方案1】:

试试这个

from scipy.optimize import curve_fit
import numpy as np

def exp_decay(x, a, b, c):
    return a * np.exp(-x*b) + c

X = (your data)
Y = (your data)

popt, pcov = curve_fit(exp_decay, X, Y, p0=(1,1,1))

查看文档here

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-08-08
    • 2021-11-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-07-05
    相关资源
    最近更新 更多