python实现一次指数平滑

l = (7082.2,8034.5,8486.4,9374.9,10198.72,10291.1,9795.3,9271.1,9225.8902,9808.1873);#初始数据#
a = 0.5#设置平滑系数#
s0 = (l[0]+l[1]+l[2])/3#数据量小于20,一般取前三项的均值#
s1 = a*l[0] + (1-a)s0
for i in range(1,11):
t = s1
s = a
l[i] + (1-a)*t
t = s
print(s)

猜你喜欢

转载自blog.csdn.net/weixin_44616447/article/details/114236204