pyFTS/fts.py

38 lines
750 B
Python
Raw Normal View History

from pyFTS import *
class FTS:
def __init__(self,order,name):
self.sets = {}
self.flrgs = {}
self.order = order
self.name = name
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):
pass
2016-10-18 16:09:36 +04:00
def train(self, data, sets):
pass
def predict(self,data):
2016-10-18 16:09:36 +04:00
return self.forecast(data)
def predictDiff(self,data,t):
2016-10-18 16:09:36 +04:00
return data[t] + self.forecast(data[t-1]-data[t])
def __str__(self):
tmp = self.name + ":\n"
for r in self.flrgs.keys():
tmp = tmp + str(self.flrgs[r]) + "\n"
return tmp