diff --git a/benchmarks/arima.py b/benchmarks/arima.py index 20ba53c..0c40b13 100644 --- a/benchmarks/arima.py +++ b/benchmarks/arima.py @@ -11,7 +11,7 @@ class ARIMA(fts.FTS): Façade for statsmodels.tsa.arima_model """ def __init__(self, name, **kwargs): - super(ARIMA, self).__init__(1, "ARIMA") + super(ARIMA, self).__init__(1, "ARIMA"+name) self.name = "ARIMA" self.detail = "Auto Regressive Integrated Moving Average" self.is_high_order = True diff --git a/benchmarks/distributed_benchmarks.py b/benchmarks/distributed_benchmarks.py index 97bc130..84cb1d0 100644 --- a/benchmarks/distributed_benchmarks.py +++ b/benchmarks/distributed_benchmarks.py @@ -8,6 +8,7 @@ python3 /usr/local/bin/dispynode.py -i [local IP] -d import datetime import time +from copy import deepcopy import dispy import dispy.httpd @@ -136,8 +137,9 @@ def point_sliding_window(data, windowsize, train=0.8, models=None, partitioners= pool.append(mfts) for count, model in enumerate(benchmark_models, start=0): - mfts = model("") - mfts.order = benchmark_models_parameters[count] + par = benchmark_models_parameters[count] + mfts = model(str(par if par is not None else "")) + mfts.order = par pool.append(mfts) experiments = 0 diff --git a/benchmarks/naive.py b/benchmarks/naive.py index 0163942..e9ea5ad 100644 --- a/benchmarks/naive.py +++ b/benchmarks/naive.py @@ -7,7 +7,7 @@ from pyFTS import fts class Naive(fts.FTS): """Naïve Forecasting method""" def __init__(self, name, **kwargs): - super(Naive, self).__init__(1, "Naive " + name) + super(Naive, self).__init__(1, "Naive") self.name = "Naïve Model" self.detail = "Naïve Model" self.benchmark_only = True diff --git a/benchmarks/quantreg.py b/benchmarks/quantreg.py index 6403b56..85bf679 100644 --- a/benchmarks/quantreg.py +++ b/benchmarks/quantreg.py @@ -10,7 +10,7 @@ from pyFTS import fts class QuantileRegression(fts.FTS): """Façade for statsmodels.regression.quantile_regression""" def __init__(self, name, **kwargs): - super(QuantileRegression, self).__init__(1, "QR") + super(QuantileRegression, self).__init__(1, "QR"+name) self.name = "QR" self.detail = "Quantile Regression" self.is_high_order = True @@ -43,8 +43,11 @@ class QuantileRegression(fts.FTS): self.upper_qt = [uqt.params[k] for k in uqt.params.keys()] self.lower_qt = [lqt.params[k] for k in lqt.params.keys()] + self.shortname = "QAR(" + str(self.order) + ")" + def linearmodel(self,data,params): - return params[0] + sum([ data[k] * params[k+1] for k in np.arange(0, self.order) ]) + #return params[0] + sum([ data[k] * params[k+1] for k in np.arange(0, self.order) ]) + return sum([data[k] * params[k] for k in np.arange(0, self.order)]) def forecast(self, data, **kwargs): ndata = np.array(self.doTransformations(data)) diff --git a/tests/general.py b/tests/general.py index a5c868f..797a9fb 100644 --- a/tests/general.py +++ b/tests/general.py @@ -57,15 +57,15 @@ from statsmodels.tsa.tsatools import lagmat from pyFTS.benchmarks import distributed_benchmarks as bchmk #from pyFTS.benchmarks import parallel_benchmarks as bchmk from pyFTS.benchmarks import Util -#from pyFTS.benchmarks import arima +from pyFTS.benchmarks import arima, quantreg #Util.cast_dataframe_to_sintetic_point("experiments/taiex_point_analitic.csv","experiments/taiex_point_sintetic.csv",11) #Util.plot_dataframe_point("experiments/taiex_point_sintetic.csv","experiments/taiex_point_analitic.csv",11) #tmp = arima.ARIMA("") -#tmp.train(taiex[:1600],None,parameters=(2,0,1)) -#teste = tmp.forecast(taiex[1598:1601]) +#tmp.train(taiex[:1600],(2,1,1)) +#teste = tmp.forecast(taiex[1600:2000]) #print(teste)