def forecast(self, ndata, **kwargs): if self.partitioner is not None: ordered_sets = self.partitioner.ordered_sets else: ordered_sets = FuzzySet.set_ordered(self.partitioner.sets) l = len(ndata) npart = len(self.partitioner) ret = [] for k in np.arange(0, l): mv = FuzzySet.fuzzyfy_instance(ndata[k], self.partitioner.sets) r = [max([ min(self.R[i][j], mv[j]) for j in np.arange(0,npart) ]) for i in np.arange(0,npart)] fs = np.ravel(np.argwhere(r == max(r))) if len(fs) == 1: ret.append(self.partitioner.sets[ordered_sets[fs[0]]].centroid) else: mp = [self.partitioner.sets[ordered_sets[s]].centroid for s in fs] ret.append( sum(mp)/len(mp)) return ret
def forecast(self, ndata, **kwargs): l = len(ndata) ret = [] for k in np.arange(0, l): mv = FuzzySet.fuzzyfy_instance(ndata[k], self.sets) actual = FuzzySet.get_maximum_membership_fuzzyset( ndata[k], self.sets) #self.sets[np.argwhere(mv == max(mv))[0, 0]] if actual.name not in self.flrgs: ret.append(actual.centroid) else: _flrg = self.flrgs[actual.name] ret.append(_flrg.get_midpoint(self.sets)) return ret