Enabling 'standard_horizon' parameter in PWFTS model
This commit is contained in:
parent
cb71bee2bc
commit
ad6d82825e
@ -181,7 +181,7 @@ class HighOrderFTS(fts.FTS):
|
|||||||
def generate_flrg_fuzzyfied(self, data):
|
def generate_flrg_fuzzyfied(self, data):
|
||||||
_tmp_steps = self.standard_horizon - 1
|
_tmp_steps = self.standard_horizon - 1
|
||||||
l = len(data)
|
l = len(data)
|
||||||
for k in np.arange(self.max_lag, l):
|
for k in np.arange(self.max_lag, l - _tmp_steps):
|
||||||
if self.dump: print("FLR: " + str(k))
|
if self.dump: print("FLR: " + str(k))
|
||||||
|
|
||||||
sample = data[k - self.max_lag: k]
|
sample = data[k - self.max_lag: k]
|
||||||
|
@ -137,8 +137,9 @@ class ProbabilisticWeightedFTS(ifts.IntervalFTS):
|
|||||||
self.generate_flrg_fuzzyfied(fuzz)
|
self.generate_flrg_fuzzyfied(fuzz)
|
||||||
|
|
||||||
def generate_flrg_fuzzyfied(self, data):
|
def generate_flrg_fuzzyfied(self, data):
|
||||||
|
_tmp_steps = self.standard_horizon - 1
|
||||||
l = len(data)
|
l = len(data)
|
||||||
for k in np.arange(self.max_lag, l):
|
for k in np.arange(self.max_lag, l - _tmp_steps):
|
||||||
sample = data[k - self.max_lag: k]
|
sample = data[k - self.max_lag: k]
|
||||||
set_sample = []
|
set_sample = []
|
||||||
for instance in sample:
|
for instance in sample:
|
||||||
@ -154,8 +155,8 @@ class ProbabilisticWeightedFTS(ifts.IntervalFTS):
|
|||||||
lhs_mv = self.pwflrg_lhs_memberhip_fuzzyfied(flrg, sample)
|
lhs_mv = self.pwflrg_lhs_memberhip_fuzzyfied(flrg, sample)
|
||||||
|
|
||||||
mvs = []
|
mvs = []
|
||||||
inst = data[k]
|
rhs = data[k + _tmp_steps]
|
||||||
for set, mv in inst:
|
for set, mv in rhs:
|
||||||
self.flrgs[flrg.get_key()].append_rhs(set, count=lhs_mv * mv)
|
self.flrgs[flrg.get_key()].append_rhs(set, count=lhs_mv * mv)
|
||||||
mvs.append(mv)
|
mvs.append(mv)
|
||||||
|
|
||||||
@ -203,8 +204,9 @@ class ProbabilisticWeightedFTS(ifts.IntervalFTS):
|
|||||||
return flrgs
|
return flrgs
|
||||||
|
|
||||||
def generate_flrg(self, data):
|
def generate_flrg(self, data):
|
||||||
|
_tmp_steps = self.standard_horizon - 1
|
||||||
l = len(data)
|
l = len(data)
|
||||||
for k in np.arange(self.max_lag, l):
|
for k in np.arange(self.max_lag, l - _tmp_steps):
|
||||||
if self.dump: print("FLR: " + str(k))
|
if self.dump: print("FLR: " + str(k))
|
||||||
|
|
||||||
sample = data[k - self.max_lag: k]
|
sample = data[k - self.max_lag: k]
|
||||||
@ -218,7 +220,7 @@ class ProbabilisticWeightedFTS(ifts.IntervalFTS):
|
|||||||
if flrg.get_key() not in self.flrgs:
|
if flrg.get_key() not in self.flrgs:
|
||||||
self.flrgs[flrg.get_key()] = flrg;
|
self.flrgs[flrg.get_key()] = flrg;
|
||||||
|
|
||||||
fuzzyfied = self.partitioner.fuzzyfy(data[k], mode='both', method='fuzzy',
|
fuzzyfied = self.partitioner.fuzzyfy(data[k+_tmp_steps], mode='both', method='fuzzy',
|
||||||
alpha_cut=self.alpha_cut)
|
alpha_cut=self.alpha_cut)
|
||||||
|
|
||||||
mvs = []
|
mvs = []
|
||||||
|
@ -38,8 +38,8 @@ l = len(dados)
|
|||||||
|
|
||||||
particionador = Grid.GridPartitioner(data = dados, npart = 10, func = Membership.trimf)
|
particionador = Grid.GridPartitioner(data = dados, npart = 10, func = Membership.trimf)
|
||||||
|
|
||||||
modelo = pwfts.ProbabilisticWeightedFTS(partitioner = particionador, order = 1)
|
modelo = pwfts.ProbabilisticWeightedFTS(partitioner = particionador, order = 1, standard_horizon=3)
|
||||||
#modelo = hofts.WeightedHighOrderFTS(partitioner = particionador, order = 1, standard_horizon=1, lags=[2])
|
#modelo = hofts.WeightedHighOrderFTS(partitioner = particionador, order = 1, standard_horizon=2)
|
||||||
#modelo = chen.ConventionalFTS(partitioner = particionador, standard_horizon=3)
|
#modelo = chen.ConventionalFTS(partitioner = particionador, standard_horizon=3)
|
||||||
|
|
||||||
modelo.fit(dados)
|
modelo.fit(dados)
|
||||||
|
Loading…
Reference in New Issue
Block a user