Bugfix on pwfts.forecast_ahead_distribution
This commit is contained in:
parent
4d3680ecf6
commit
6dcdd8f59e
@ -21,7 +21,7 @@ class ProbabilisticWeightedFLRG(hofts.HighOrderFLRG):
|
||||
self.Z = None
|
||||
|
||||
def get_membership(self, data, sets):
|
||||
if isinstance(data, (np.ndarray, list)):
|
||||
if isinstance(data, (np.ndarray, list, tuple, set)):
|
||||
return np.nanprod([sets[key].membership(data[count])
|
||||
for count, key in enumerate(self.LHS, start=0)])
|
||||
else:
|
||||
|
@ -19,20 +19,20 @@ tdiff = Transformations.Differential(1)
|
||||
|
||||
from pyFTS.data import TAIEX, SP500, NASDAQ, Malaysia, Enrollments
|
||||
|
||||
fig, ax = plt.subplots(nrows=1, ncols=1, figsize=[15,7])
|
||||
from pyFTS.data import mackey_glass
|
||||
y = mackey_glass.get_data()
|
||||
|
||||
from pyFTS.partitioners import Grid
|
||||
from pyFTS.models import pwfts
|
||||
|
||||
fs = Simple.SimplePartitioner()
|
||||
partitioner = Grid.GridPartitioner(data=y, npart=35)
|
||||
|
||||
fs.append("A", Membership.trimf, [0,1,2])
|
||||
fs.append("B", Membership.trapmf, [1,2,3,4])
|
||||
fs.append("C", Membership.gaussmf, [5,1])
|
||||
fs.append("D", Membership.singleton, [8])
|
||||
fs.append("E", Membership.sigmf, [2, 10])
|
||||
model = pwfts.ProbabilisticWeightedFTS(partitioner=partitioner, order=2)
|
||||
model.fit(y[:800])
|
||||
|
||||
fs.plot(ax)
|
||||
from pyFTS.benchmarks import benchmarks as bchmk
|
||||
|
||||
print(fs)
|
||||
distributions = model.predict(y[800:820], steps_ahead=20, type='distribution')
|
||||
|
||||
|
||||
'''
|
||||
|
Loading…
Reference in New Issue
Block a user