diff --git a/pyFTS/common/FuzzySet.py b/pyFTS/common/FuzzySet.py index 617b519..43af285 100644 --- a/pyFTS/common/FuzzySet.py +++ b/pyFTS/common/FuzzySet.py @@ -141,7 +141,7 @@ def fuzzyfy(data, partitioner, **kwargs): if mode == 'vector': return fuzzyfy_instance(data, partitioner.sets, partitioner.ordered_sets) elif mode == 'both': - mv = fuzzyfy_instances(data, partitioner.sets, partitioner.ordered_sets) + mv = fuzzyfy_instance(data, partitioner.sets, partitioner.ordered_sets) fsets = [(partitioner.ordered_sets[ix], mv[ix]) for ix in np.arange(len(mv)) if mv[ix] >= alpha_cut] diff --git a/pyFTS/models/multivariate/cmvfts.py b/pyFTS/models/multivariate/cmvfts.py index bea237a..715033f 100644 --- a/pyFTS/models/multivariate/cmvfts.py +++ b/pyFTS/models/multivariate/cmvfts.py @@ -69,7 +69,7 @@ class ClusteredMVFTS(mvfts.MVFTS): if self.pre_fuzzyfy: ndata = self.fuzzyfy(ndata) else: - ndata = [self.format(k) for k in ndata.to_dict('records')] + ndata = [self.format_data(k) for k in ndata.to_dict('records')] return self.model.forecast(ndata, fuzzyfied=self.pre_fuzzyfy, **kwargs) diff --git a/pyFTS/tests/general.py b/pyFTS/tests/general.py index 78ea4df..8f55561 100644 --- a/pyFTS/tests/general.py +++ b/pyFTS/tests/general.py @@ -25,7 +25,7 @@ p = Grid.GridPartitioner(data=dataset, npart=20) print(p) -model = hofts.HighOrderFTS(partitioner=p, order=2) +model = pwfts.ProbabilisticWeightedFTS(partitioner=p, order=2) model.fit(dataset) #[22, 22, 23, 23, 24]) diff --git a/pyFTS/tests/multivariate.py b/pyFTS/tests/multivariate.py index aff0951..4dba416 100644 --- a/pyFTS/tests/multivariate.py +++ b/pyFTS/tests/multivariate.py @@ -18,6 +18,17 @@ from pyFTS.models.multivariate import common, variable, mvfts, cmvfts from pyFTS.models.seasonal import partitioner as seasonal from pyFTS.models.seasonal.common import DateTime +dataset = pd.read_csv('https://query.data.world/s/2bgegjggydd3venttp3zlosh3wpjqj', sep=';') + +dataset['data'] = pd.to_datetime(dataset["data"], format='%Y-%m-%d %H:%M:%S') + +data = dataset['glo_avg'].values + +train_mv = dataset.iloc[:24505] +test_mv = dataset.iloc[24505:] + + + ''' model = Util.load_obj('/home/petronio/Downloads/ClusteredMVFTS1solarorder2knn3') @@ -40,7 +51,7 @@ for ix, row in df.iterrows(): ''' # Multivariate time series - +''' dataset = pd.read_csv('https://query.data.world/s/2bgegjggydd3venttp3zlosh3wpjqj', sep=';') dataset['data'] = pd.to_datetime(dataset["data"], format='%Y-%m-%d %H:%M:%S') @@ -63,8 +74,17 @@ model.append_variable(vavg) model.target_variable = vavg model.fit(train_mv) +Util.persist_obj(model, model.shortname) +''' + +#model = Util.load_obj("ClusteredMVFTS") + +model = Util.load_obj("ClusteredMVFTS2loadorder2knn2") + print(model) +print(model.predict(test_mv)) + ''' train_mv = {} test_mv = {}