diff --git a/pyFTS/models/pwfts.py b/pyFTS/models/pwfts.py index e0248bd..48d9b21 100644 --- a/pyFTS/models/pwfts.py +++ b/pyFTS/models/pwfts.py @@ -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: diff --git a/pyFTS/tests/general.py b/pyFTS/tests/general.py index 03009a0..94de7af 100644 --- a/pyFTS/tests/general.py +++ b/pyFTS/tests/general.py @@ -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') '''