pyFTS是用于做模糊时间序列的开源包,其中包含各种模型。本篇主要讲解pyFTS包中common下transformations中的各函数用法.
1.BoxCox 取对数
from pyFTS.common import Transformations
#BoxCox的输入数据为apply形式
#BoxCox的计算公式为y(t')=ln(y(t))
boxcox = Transformations.BoxCox(0)
boxcox.apply([13055])
#返回值为:array([9.47692648])
#ln(13055)=9.47692648
2.Differential 差分
from pyFTS.common import Transformations
#lag为差分步长
#其计算公式为:y'(t)=y(t)-y(t-lag)
lag=2
tdiff = Transformations.Differential(lag)
tdiff.apply([13055,13056,13058,13060])
#输出值为:[0, 0, 3, 4]
#y'(3)=y(3)-y(1) 即3=13058-13055
#y'(4)=y(4)-y(2) 即4=13060-13056
3.Z 正态化
from pyFTS.common import Transformations
#Z为标准化(正态化)
normal=Transformations.Z
normal([13055,13056,13054])
#均值为0,标准差为0.8165
#输