diff --git a/pyFTS/benchmarks/Measures.py b/pyFTS/benchmarks/Measures.py index ca156fe..310d72d 100644 --- a/pyFTS/benchmarks/Measures.py +++ b/pyFTS/benchmarks/Measures.py @@ -345,7 +345,10 @@ def get_point_statistics(data, model, **kwargs): if not isinstance(forecasts, (list, np.ndarray)): forecasts = [forecasts] - forecasts = np.array(forecasts[:-1]) + if len(forecasts) != len(ndata) - model.max_lag: + forecasts = np.array(forecasts[:-1]) + else: + forecasts = np.array(forecasts) ret.append(np.round(rmse(ndata[model.max_lag:], forecasts), 2)) ret.append(np.round(mape(ndata[model.max_lag:], forecasts), 2)) diff --git a/pyFTS/models/hofts.py b/pyFTS/models/hofts.py index 917f32e..5b9f143 100644 --- a/pyFTS/models/hofts.py +++ b/pyFTS/models/hofts.py @@ -175,7 +175,7 @@ class HighOrderFTS(fts.FTS): for flrg in flrgs: if flrg.get_key() not in self.flrgs: - self.flrgs[flrg.get_key()] = flrg; + self.flrgs[flrg.get_key()] = flrg for st in rhs: self.flrgs[flrg.get_key()].append_rhs(st) diff --git a/pyFTS/models/multivariate/cmvfts.py b/pyFTS/models/multivariate/cmvfts.py index bedf4d5..6e9e0a6 100644 --- a/pyFTS/models/multivariate/cmvfts.py +++ b/pyFTS/models/multivariate/cmvfts.py @@ -19,7 +19,7 @@ class ClusteredMVFTS(mvfts.MVFTS): self.cluster = None """The most recent trained clusterer""" - self.fts_method = kwargs.get('fts_method', hofts.HighOrderFTS) + self.fts_method = kwargs.get('fts_method', hofts.WeightedHighOrderFTS) """The FTS method to be called when a new model is build""" self.fts_params = kwargs.get('fts_params', {}) """The FTS method specific parameters""" diff --git a/pyFTS/tests/general.py b/pyFTS/tests/general.py index ac078b7..6c1debb 100644 --- a/pyFTS/tests/general.py +++ b/pyFTS/tests/general.py @@ -31,6 +31,8 @@ model.fit(dataset) #[22, 22, 23, 23, 24]) print(model) +Measures.get_point_statistics(dataset, model) + ''' #dataset = SP500.get_data()[11500:16000] #dataset = NASDAQ.get_data() diff --git a/pyFTS/tests/multivariate.py b/pyFTS/tests/multivariate.py index b405c14..224e59f 100644 --- a/pyFTS/tests/multivariate.py +++ b/pyFTS/tests/multivariate.py @@ -100,7 +100,7 @@ model1.append_variable(vprice) model1.target_variable = vprice model1.fit(train_mv) -#print(model1) +print(model1) print(Measures.get_point_statistics(test_mv, model1)) #""" \ No newline at end of file