From b1a835f7002eeff025142e405a3df6cb8025dbfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=C3=B4nio=20C=C3=A2ndido?= Date: Sat, 7 Jul 2018 17:25:33 -0300 Subject: [PATCH] Introducing alpha_cut on MVFTS variables --- pyFTS/models/multivariate/common.py | 4 ++-- pyFTS/models/multivariate/mvfts.py | 2 +- pyFTS/models/multivariate/variable.py | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pyFTS/models/multivariate/common.py b/pyFTS/models/multivariate/common.py index 8ec14ed..1800d88 100644 --- a/pyFTS/models/multivariate/common.py +++ b/pyFTS/models/multivariate/common.py @@ -2,9 +2,9 @@ import numpy as np import pandas as pd -def fuzzyfy_instance(data_point, var, alpha_cut=0.0): +def fuzzyfy_instance(data_point, var): mv = np.array([var.partitioner.sets[key].membership(data_point) for key in var.partitioner.ordered_sets]) - ix = np.ravel(np.argwhere(mv > alpha_cut)) + ix = np.ravel(np.argwhere(mv > var.alpha_cut)) sets = [(var.name, var.partitioner.ordered_sets[i]) for i in ix] return sets diff --git a/pyFTS/models/multivariate/mvfts.py b/pyFTS/models/multivariate/mvfts.py index 16ee890..0ea8c44 100644 --- a/pyFTS/models/multivariate/mvfts.py +++ b/pyFTS/models/multivariate/mvfts.py @@ -41,7 +41,7 @@ class MVFTS(fts.FTS): lags = {} for vc, var in enumerate(self.explanatory_variables): data_point = data[var.data_label] - lags[vc] = common.fuzzyfy_instance(data_point, var, self.alpha_cut) + lags[vc] = common.fuzzyfy_instance(data_point, var) root = tree.FLRGTreeNode(None) diff --git a/pyFTS/models/multivariate/variable.py b/pyFTS/models/multivariate/variable.py index da84a5a..08f5214 100644 --- a/pyFTS/models/multivariate/variable.py +++ b/pyFTS/models/multivariate/variable.py @@ -24,6 +24,7 @@ class Variable: self.transformation = kwargs.get('transformation', None) self.transformation_params = kwargs.get('transformation_params', None) self.partitioner = None + self.alpha_cut = kwargs.get('alpha_cut', 0.0) if kwargs.get('data', None) is not None: self.build(**kwargs)