Padronização dos nomes das funções

This commit is contained in:
Petrônio Cândido de Lima e Silva 2016-10-18 10:09:36 -02:00
parent 3c2b452bbb
commit 9ad5af49a4
7 changed files with 20 additions and 20 deletions

View File

@ -22,7 +22,7 @@ class ConventionalFTS(fts.FTS):
def __init__(self,name): def __init__(self,name):
super(ConventionalFTS, self).__init__(1,name) super(ConventionalFTS, self).__init__(1,name)
def defuzzy(self,data): def forecast(self,data):
actual = self.fuzzy(data) actual = self.fuzzy(data)
@ -40,7 +40,7 @@ class ConventionalFTS(fts.FTS):
return denom/count return denom/count
def learn(self, data, sets): def train(self, data, sets):
last = {"fuzzyset":"", "membership":0.0} last = {"fuzzyset":"", "membership":0.0}
actual = {"fuzzyset":"", "membership":0.0} actual = {"fuzzyset":"", "membership":0.0}

8
fts.py
View File

@ -18,17 +18,17 @@ class FTS:
return best return best
def defuzzy(self,data): def forecast(self,data):
pass pass
def learn(self, data, sets): def train(self, data, sets):
pass pass
def predict(self,data): def predict(self,data):
return self.defuzzy(data) return self.forecast(data)
def predictDiff(self,data,t): def predictDiff(self,data,t):
return data[t] + self.defuzzy(data[t-1]-data[t]) return data[t] + self.forecast(data[t-1]-data[t])
def __str__(self): def __str__(self):
tmp = self.name + ":\n" tmp = self.name + ":\n"

View File

@ -5,7 +5,7 @@ class HighOrderFTS(fts.FTS):
def __init__(self,order,name): def __init__(self,order,name):
super(HighOrderFTS, self).__init__(order,name) super(HighOrderFTS, self).__init__(order,name)
def defuzzy(self,data,t): def forecast(self,data,t):
cn = np.array([0.0 for k in range(len(self.sets))]) cn = np.array([0.0 for k in range(len(self.sets))])
ow = np.array([[0.0 for k in range(len(self.sets))] for z in range(self.order-1)]) ow = np.array([[0.0 for k in range(len(self.sets))] for z in range(self.order-1)])
rn = np.array([[0.0 for k in range(len(self.sets))] for z in range(self.order-1)]) rn = np.array([[0.0 for k in range(len(self.sets))] for z in range(self.order-1)])
@ -27,11 +27,11 @@ class HighOrderFTS(fts.FTS):
return out / count return out / count
def learn(self, data, sets): def train(self, data, sets):
self.sets = sets self.sets = sets
def predict(self,data,t): def predict(self,data,t):
return self.defuzzy(data,t) return self.forecast(data,t)
def predictDiff(self,data,t): def predictDiff(self,data,t):
return data[t] + self.defuzzy(common.differential(data),t) return data[t] + self.forecast(common.differential(data),t)

View File

@ -31,7 +31,7 @@ class ImprovedWeightedFTS(fts.FTS):
def __init__(self,name): def __init__(self,name):
super(ImprovedWeightedFTS, self).__init__(1,name) super(ImprovedWeightedFTS, self).__init__(1,name)
def defuzzy(self,data): def forecast(self,data):
actual = self.fuzzy(data) actual = self.fuzzy(data)
if actual["fuzzyset"] not in self.flrgs: if actual["fuzzyset"] not in self.flrgs:
return self.sets[actual["fuzzyset"]].centroid return self.sets[actual["fuzzyset"]].centroid
@ -39,7 +39,7 @@ class ImprovedWeightedFTS(fts.FTS):
mi = np.array([self.sets[s].centroid for s in flrg.RHS.keys()]) mi = np.array([self.sets[s].centroid for s in flrg.RHS.keys()])
return mi.dot( flrg.weights() ) return mi.dot( flrg.weights() )
def learn(self, data, sets): def train(self, data, sets):
last = {"fuzzyset":"", "membership":0.0} last = {"fuzzyset":"", "membership":0.0}
actual = {"fuzzyset":"", "membership":0.0} actual = {"fuzzyset":"", "membership":0.0}

View File

@ -34,7 +34,7 @@ class ExponentialyWeightedFTS(fts.FTS):
def __init__(self,name): def __init__(self,name):
super(ExponentialyWeightedFTS, self).__init__(1,name) super(ExponentialyWeightedFTS, self).__init__(1,name)
def defuzzy(self,data): def forecast(self,data):
actual = self.fuzzy(data) actual = self.fuzzy(data)
@ -47,7 +47,7 @@ class ExponentialyWeightedFTS(fts.FTS):
return mi.dot( flrg.weights() ) return mi.dot( flrg.weights() )
def learn(self, data, sets): def train(self, data, sets):
last = {"fuzzyset":"", "membership":0.0} last = {"fuzzyset":"", "membership":0.0}
actual = {"fuzzyset":"", "membership":0.0} actual = {"fuzzyset":"", "membership":0.0}

View File

@ -21,9 +21,9 @@ class SeasonalFLRG(fts.FTS):
class SeasonalFTS(fts.FTS): class SeasonalFTS(fts.FTS):
def __init__(self,name): def __init__(self,name):
super(WeightedFTS, self).__init__(1,name) super(SeasonalFTS, self).__init__(1,name)
def defuzzy(self,data): def forecast(self,data):
actual = self.fuzzy(data) actual = self.fuzzy(data)
@ -36,7 +36,7 @@ class SeasonalFTS(fts.FTS):
return mi.dot( flrg.weights() ) return mi.dot( flrg.weights() )
def learn(self, data, sets): def train(self, data, sets):
last = {"fuzzyset":"", "membership":0.0} last = {"fuzzyset":"", "membership":0.0}
actual = {"fuzzyset":"", "membership":0.0} actual = {"fuzzyset":"", "membership":0.0}
@ -50,7 +50,7 @@ class SeasonalFTS(fts.FTS):
if count > self.order: if count > self.order:
if last["fuzzyset"] not in self.flrgs: if last["fuzzyset"] not in self.flrgs:
self.flrgs[last["fuzzyset"]] = WeightedFLRG(last["fuzzyset"]) self.flrgs[last["fuzzyset"]] = SeasonalFLRG(last["fuzzyset"])
self.flrgs[last["fuzzyset"]].append(actual["fuzzyset"]) self.flrgs[last["fuzzyset"]].append(actual["fuzzyset"])
count = count + 1 count = count + 1

4
yu.py
View File

@ -32,7 +32,7 @@ class WeightedFTS(fts.FTS):
def __init__(self,name): def __init__(self,name):
super(WeightedFTS, self).__init__(1,name) super(WeightedFTS, self).__init__(1,name)
def defuzzy(self,data): def forecast(self,data):
actual = self.fuzzy(data) actual = self.fuzzy(data)
@ -45,7 +45,7 @@ class WeightedFTS(fts.FTS):
return mi.dot( flrg.weights() ) return mi.dot( flrg.weights() )
def learn(self, data, sets): def train(self, data, sets):
last = {"fuzzyset":"", "membership":0.0} last = {"fuzzyset":"", "membership":0.0}
actual = {"fuzzyset":"", "membership":0.0} actual = {"fuzzyset":"", "membership":0.0}