From 0e2ea9927da0e3e41e30d5a702731198bbbb61bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=C3=B4nio=20C=C3=A2ndido?= Date: Wed, 28 Feb 2018 14:40:03 -0300 Subject: [PATCH] - Initial infrastructure for multivariate methods --- pyFTS/models/multivariate/FLR.py | 22 ++++++++++++++++++++++ pyFTS/models/multivariate/__init__.py | 0 pyFTS/models/multivariate/common.py | 26 ++++++++++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 pyFTS/models/multivariate/FLR.py create mode 100644 pyFTS/models/multivariate/__init__.py create mode 100644 pyFTS/models/multivariate/common.py diff --git a/pyFTS/models/multivariate/FLR.py b/pyFTS/models/multivariate/FLR.py new file mode 100644 index 0000000..8747086 --- /dev/null +++ b/pyFTS/models/multivariate/FLR.py @@ -0,0 +1,22 @@ + + +class FLR(object): + """Multivariate Fuzzy Logical Relationship""" + + def __init__(self): + """ + Creates a Fuzzy Logical Relationship + :param LHS: Left Hand Side fuzzy set + :param RHS: Right Hand Side fuzzy set + """ + self.LHS = {} + self.RHS = None + + def set_lhs(self,var,set): + self.LHS[var] = set + + def set_rhs(self, set): + self.RHS = set + + def __str__(self): + return str([k.name for k in self.LHS]) + " -> " + self.RHS.name \ No newline at end of file diff --git a/pyFTS/models/multivariate/__init__.py b/pyFTS/models/multivariate/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/pyFTS/models/multivariate/common.py b/pyFTS/models/multivariate/common.py new file mode 100644 index 0000000..934bf78 --- /dev/null +++ b/pyFTS/models/multivariate/common.py @@ -0,0 +1,26 @@ +from pyFTS.common import fts + + +class Variable: + def __init__(self,name, **kwargs): + self.name = name + self.alias = kwargs.get('alias', self.name) + self.data_label = kwargs.get('alias', self.name) + self.partitioner = kwargs.get('partitioner',None) + self.type = kwargs.get('type', 'common') + self.transformation = kwargs.get('transformation', None) + + def __str__(self): + return self.name + + +class MVFTS(fts.FTS): + def __init__(self, name, **kwargs): + super(MVFTS, self).__init__(1, name, **kwargs) + self.explanatory_variables = [] + self.target_variable = None + + def append_variable(self, var): + self.explanatory_variables.append(var) + +