32 lines
611 B
Python
32 lines
611 B
Python
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
|
|
|
|
def forecast(self,data):
|
|
pass
|
|
|
|
def train(self, data, sets):
|
|
pass
|
|
|
|
def __str__(self):
|
|
tmp = self.name + ":\n"
|
|
for r in self.flrgs.keys():
|
|
tmp = tmp + str(self.flrgs[r]) + "\n"
|
|
return tmp
|