Introducing alpha_cut on MVFTS variables

This commit is contained in:
Petrônio Cândido 2018-07-07 17:25:33 -03:00
parent 07bfceae78
commit b1a835f700
3 changed files with 4 additions and 3 deletions

View File

@ -2,9 +2,9 @@ import numpy as np
import pandas as pd 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]) 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] sets = [(var.name, var.partitioner.ordered_sets[i]) for i in ix]
return sets return sets

View File

@ -41,7 +41,7 @@ class MVFTS(fts.FTS):
lags = {} lags = {}
for vc, var in enumerate(self.explanatory_variables): for vc, var in enumerate(self.explanatory_variables):
data_point = data[var.data_label] 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) root = tree.FLRGTreeNode(None)

View File

@ -24,6 +24,7 @@ class Variable:
self.transformation = kwargs.get('transformation', None) self.transformation = kwargs.get('transformation', None)
self.transformation_params = kwargs.get('transformation_params', None) self.transformation_params = kwargs.get('transformation_params', None)
self.partitioner = None self.partitioner = None
self.alpha_cut = kwargs.get('alpha_cut', 0.0)
if kwargs.get('data', None) is not None: if kwargs.get('data', None) is not None:
self.build(**kwargs) self.build(**kwargs)