【发布时间】:2020-08-09 15:18:35
【问题描述】:
指数衰减的公式是:
np.exp(-(t/n))
其中 t 是时间步长,n 是控制衰减速度的系数。 我正在寻找的是 running-函数,我在其中手动计算每一步的值,以及在衰减期间添加值的能力。
我该怎么做?
我还找到了另一个公式:(1-percent)^t
def decay(val, rate): return val * np.exp(-rate)
In [84]: decay(1,1/10.)
Out[84]: 0.905
In [85]: decay(0.905,1/10.)
Out[85]: 0.819
In [86]: decay(0.819,1/10.)
Out[86]: 0.741
In [88]: np.exp(-1/10.)
Out[88]: 0.905
In [89]: np.exp(-2/10.)
Out[89]: 0.819
In [90]: np.exp(-3/10.)
Out[90]: 0.741
【问题讨论】:
-
我投票结束这个问题,因为这是一道数学题。
-
这是一个正在运行的 exp 衰减 .. 即程序员问题 ... 即将数学公式转换为算法!!!
-
你为什么不做一个循环并添加
decay函数返回?如果您正在寻找总和的明确公式,那么是的,这是一个数学问题。
标签: python exponential cumulative-sum decrement