IFTS now heritages from WHOFTS

This commit is contained in:
Petrônio Cândido 2019-03-22 14:36:10 -03:00
parent 4b8b0243d7
commit 838140d0f2
2 changed files with 32 additions and 5 deletions

View File

@ -66,8 +66,35 @@ class WeightedHighOrderFLRG(flrg.FLRG):
return self.w
def get_midpoint(self, sets):
mp = np.array([sets[c].centroid for c in self.RHS.keys()])
return mp.dot(self.weights())
if self.midpoint is None:
mp = np.array([sets[c].centroid for c in self.RHS.keys()])
self.midpoint = mp.dot(self.weights())
return self.midpoint
def get_lower(self, sets):
"""
Returns the lower bound value for the RHS fuzzy sets
:param sets: fuzzy sets
:return: lower bound value
"""
if self.lower is None:
lw = np.array([sets[s].lower for s in self.RHS.keys()])
self.lower = lw.dot(self.weights())
return self.lower
def get_upper(self, sets):
"""
Returns the upper bound value for the RHS fuzzy sets
:param sets: fuzzy sets
:return: upper bound value
"""
if self.upper is None:
up = np.array([sets[s].upper for s in self.RHS.keys()])
self.upper = up.dot(self.weights())
return self.upper
def __str__(self):
_str = ""

View File

@ -13,7 +13,7 @@ from pyFTS.common import FuzzySet, FLR, fts, tree
from pyFTS.models import hofts
class IntervalFTS(hofts.HighOrderFTS):
class IntervalFTS(hofts.WeightedHighOrderFTS):
"""
High Order Interval Fuzzy Time Series
"""
@ -43,9 +43,9 @@ class IntervalFTS(hofts.HighOrderFTS):
if len(flrg.LHS) > 0:
if flrg.get_key() in self.flrgs:
tmp = self.flrgs[flrg.get_key()]
ret = tmp.get_lower(self.sets)
ret = tmp.get_lower(self.partitioner.sets)
else:
ret = self.sets[flrg.LHS[-1]].lower
ret = self.partitioner.sets[flrg.LHS[-1]].lower
return ret
def get_sequence_membership(self, data, fuzzySets):