2016-10-19 17:27:57 +04:00
|
|
|
import numpy as np
|
2016-09-08 16:03:32 +04:00
|
|
|
from pyFTS import *
|
|
|
|
|
2016-09-02 22:55:55 +04:00
|
|
|
class FTS:
|
|
|
|
def __init__(self,order,name):
|
|
|
|
self.sets = {}
|
|
|
|
self.flrgs = {}
|
|
|
|
self.order = order
|
2016-10-25 22:21:32 +04:00
|
|
|
self.shortname = name
|
2016-09-02 22:55:55 +04:00
|
|
|
self.name = name
|
2016-10-25 22:21:32 +04:00
|
|
|
self.detail = name
|
|
|
|
self.isSeasonal = False
|
|
|
|
self.isInterval = False
|
2016-09-02 22:55:55 +04:00
|
|
|
|
|
|
|
def fuzzy(self,data):
|
|
|
|
best = {"fuzzyset":"", "membership":0.0}
|
|
|
|
|
|
|
|
for f in self.sets:
|
|
|
|
fset = self.sets[f]
|
|
|
|
if best["membership"] <= fset.membership(data):
|
|
|
|
best["fuzzyset"] = fset.name
|
|
|
|
best["membership"] = fset.membership(data)
|
|
|
|
|
|
|
|
return best
|
|
|
|
|
2016-10-18 16:09:36 +04:00
|
|
|
def forecast(self,data):
|
2016-09-02 22:55:55 +04:00
|
|
|
pass
|
|
|
|
|
2016-10-18 16:09:36 +04:00
|
|
|
def train(self, data, sets):
|
2016-09-02 22:55:55 +04:00
|
|
|
pass
|
2016-10-19 17:27:57 +04:00
|
|
|
|
|
|
|
def getMidpoints(self,flrg):
|
|
|
|
ret = np.array([s.centroid for s in flrg.RHS])
|
|
|
|
return ret
|
2016-09-02 22:55:55 +04:00
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
tmp = self.name + ":\n"
|
2016-10-19 20:45:01 +04:00
|
|
|
for r in sorted(self.flrgs):
|
2016-09-02 22:55:55 +04:00
|
|
|
tmp = tmp + str(self.flrgs[r]) + "\n"
|
|
|
|
return tmp
|