diff --git a/pyFTS/benchmarks/BSTS.py b/pyFTS/benchmarks/BSTS.py index 35bd014..e2b012f 100644 --- a/pyFTS/benchmarks/BSTS.py +++ b/pyFTS/benchmarks/BSTS.py @@ -43,7 +43,7 @@ class ARIMA(fts.FTS): self.order = self.p + self.q + (self.q - 1 if self.q > 0 else 0) self.max_lag = self.order self.d = len(self.transformations) - self.shortname = "ARIMA(" + str(self.p) + "," + str(self.d) + "," + str(self.q) + ") - " + str(self.alpha) + self.shortname = "BSTS({},{},{})-{}".format(self.p,self.d,self.q,self.alpha) def train(self, data, **kwargs): diff --git a/pyFTS/benchmarks/arima.py b/pyFTS/benchmarks/arima.py index 8f0c29a..2476c89 100644 --- a/pyFTS/benchmarks/arima.py +++ b/pyFTS/benchmarks/arima.py @@ -42,7 +42,7 @@ class ARIMA(fts.FTS): self.order = self.p + self.q + (self.q - 1 if self.q > 0 else 0) self.max_lag = self.order self.d = len(self.transformations) - self.shortname = "ARIMA(" + str(self.p) + "," + str(self.d) + "," + str(self.q) + ") - " + str(self.alpha) + self.shortname = "ARIMA({},{},{})-{}".format(self.p, self.d, self.q, self.alpha) def train(self, data, **kwargs): diff --git a/pyFTS/benchmarks/knn.py b/pyFTS/benchmarks/knn.py index e51ba18..a513f2d 100644 --- a/pyFTS/benchmarks/knn.py +++ b/pyFTS/benchmarks/knn.py @@ -61,6 +61,8 @@ class KNearestNeighbors(fts.FTS): self.kdtree = KDTree(np.array(X)) self.values = Y + self.shortname = "kNN({})-{}".format(self.order, self.alpha) + def knn(self, sample): X = self._prepare_x(sample) _, ix = self.kdtree.query(np.array(X), self.k) diff --git a/pyFTS/benchmarks/quantreg.py b/pyFTS/benchmarks/quantreg.py index a2d5bcd..9bcdcb2 100644 --- a/pyFTS/benchmarks/quantreg.py +++ b/pyFTS/benchmarks/quantreg.py @@ -54,7 +54,7 @@ class QuantileRegression(fts.FTS): up_qt = [k for k in uqt.params] self.dist_qt.append([lo_qt, up_qt]) - self.shortname = "QAR(" + str(self.order) + ") - " + str(self.alpha) + self.shortname = "QAR({})-{}".format(self.order,self.alpha) def linearmodel(self,data,params): #return params[0] + sum([ data[k] * params[k+1] for k in np.arange(0, self.order) ]) diff --git a/pyFTS/tests/general.py b/pyFTS/tests/general.py index 2799453..da2d1e4 100644 --- a/pyFTS/tests/general.py +++ b/pyFTS/tests/general.py @@ -19,7 +19,7 @@ from pyFTS.fcm import fts, common, GA from pyFTS.data import TAIEX, NASDAQ, SP500 -#''' +''' train = TAIEX.get_data()[:800] test = TAIEX.get_data()[800:1000] @@ -52,13 +52,22 @@ datasets['TAIEX'] = TAIEX.get_data()[:5000] datasets['NASDAQ'] = NASDAQ.get_data()[:5000] datasets['SP500'] = SP500.get_data()[10000:15000] -methods = [arima.ARIMA, quantreg.QuantileRegression, BSTS.ARIMA, knn.KNearestNeighbors] +methods = [ + arima.ARIMA,arima.ARIMA, + quantreg.QuantileRegression,quantreg.QuantileRegression, + BSTS.ARIMA,BSTS.ARIMA, + knn.KNearestNeighbors,knn.KNearestNeighbors + ] methods_parameters = [ - {'order':(2,0,0)}, - {'order':2, 'dist': True}, - {'order':(2,0,0)}, - {'order':2 } + {'order':(2,0,0), 'alpha':.05}, + {'order':(2,0,0), 'alpha':.25}, + {'order':2, 'alpha':.05}, + {'order':2, 'alpha':.25}, + {'order': (2, 0, 0), 'alpha': .05}, + {'order': (2, 0, 0), 'alpha': .25}, + {'order': 2, 'alpha': .05}, + {'order': 2, 'alpha': .25} ] for dataset_name, dataset in datasets.items(): @@ -72,8 +81,8 @@ for dataset_name, dataset in datasets.items(): orders=[], steps_ahead=[10], partitions=[], - type='distribution', + type='interval', distributed=True, nodes=['192.168.0.110', '192.168.0.107','192.168.0.106'], file="experiments.db", dataset=dataset_name, tag="experiments") # file="tmp.db", dataset='TAIEX', tag="experiments") -''' \ No newline at end of file +#''' \ No newline at end of file