From e5c2e0dcbde7c3410dd9aacc141369696c62a68d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=C3=B4nio=20C=C3=A2ndido=20de=20Lima=20e=20Silva?= Date: Thu, 20 Apr 2017 15:07:34 -0300 Subject: [PATCH] - Adaptive Expectation transformation [Cheng, 2008] --- common/Transformations.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/common/Transformations.py b/common/Transformations.py index 8bbcf66..53285aa 100644 --- a/common/Transformations.py +++ b/common/Transformations.py @@ -60,6 +60,26 @@ class Differential(Transformation): return inc +class AdaptiveExpectation(Transformation): + + def __init__(self, parameters): + super(AdaptiveExpectation, self).__init__(parameters) + self.h = parameters + + def apply(self, data, param=None): + return data + + def inverse(self, data, param): + n = len(data) + + inc = [param[t] + self.h*(data[t] - param[t]) for t in np.arange(0, n)] + + if n == 1: + return inc[0] + else: + return inc + + def boxcox(original, plambda): n = len(original) if plambda != 0: