2016-12-22 20:15:07 +04:00
|
|
|
import numpy as np
|
2016-12-23 14:18:33 +04:00
|
|
|
import math
|
2016-12-22 20:15:07 +04:00
|
|
|
from pyFTS import *
|
|
|
|
|
2016-12-23 14:18:33 +04:00
|
|
|
|
2016-12-22 20:15:07 +04:00
|
|
|
def differential(original):
|
|
|
|
n = len(original)
|
2016-12-23 14:18:33 +04:00
|
|
|
diff = [original[t - 1] - original[t] for t in np.arange(1, n)]
|
|
|
|
diff.insert(0, 0)
|
|
|
|
return np.array(diff)
|
|
|
|
|
|
|
|
|
|
|
|
def boxcox(original, plambda):
|
|
|
|
n = len(original)
|
|
|
|
if plambda != 0:
|
|
|
|
modified = [(original[t] ** plambda - 1) / plambda for t in np.arange(0, n)]
|
|
|
|
else:
|
|
|
|
modified = [math.log(original[t]) for t in np.arange(0, n)]
|
|
|
|
return np.array(modified)
|