diff --git a/benchmarks/arima.py b/benchmarks/arima.py index a5e1817..7e7162a 100644 --- a/benchmarks/arima.py +++ b/benchmarks/arima.py @@ -33,7 +33,7 @@ class ARIMA(fts.FTS): self.d = order[1] self.q = order[2] self.order = self.p + self.q - self.shortname = "ARIMA(" + str(self.p) + "," + str(self.d) + "," + str(self.q) + ")" + self.shortname = "ARIMA(" + str(self.p) + "," + str(self.d) + "," + str(self.q) + ") - " + str(self.alpha) old_fit = self.model_fit try: diff --git a/benchmarks/quantreg.py b/benchmarks/quantreg.py index 88d3570..57d6090 100644 --- a/benchmarks/quantreg.py +++ b/benchmarks/quantreg.py @@ -41,7 +41,7 @@ class QuantileRegression(fts.FTS): self.upper_qt = [k for k in uqt.params] self.lower_qt = [k for k in lqt.params] - self.shortname = "QAR(" + str(self.order) + ")" + self.shortname = "QAR(" + str(self.order) + ") - " + str(self.alpha) def linearmodel(self,data,params): #return params[0] + sum([ data[k] * params[k+1] for k in np.arange(0, self.order) ]) @@ -74,7 +74,7 @@ class QuantileRegression(fts.FTS): sample = ndata[k - self.order: k] up = self.linearmodel(sample, self.upper_qt) down = self.linearmodel(sample, self.lower_qt) - ret.append([up, down]) + ret.append([down, up]) ret = self.doInverseTransformations(ret, params=[data[self.order - 1:]], interval=True) diff --git a/tests/general.py b/tests/general.py index 3ac8ea6..ed7abac 100644 --- a/tests/general.py +++ b/tests/general.py @@ -54,7 +54,7 @@ nasdaq = np.array(nasdaqpd["avg"][0:5000]) 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, quantreg +from pyFTS.benchmarks import arima, quantreg, Measures #Util.cast_dataframe_to_synthetic_point("experiments/taiex_point_analitic.csv","experiments/taiex_point_sintetic.csv",11) @@ -64,13 +64,18 @@ from pyFTS.benchmarks import arima, quantreg #tmp.train(taiex[:1600], None, order=(2,0,2)) #teste = tmp.forecastInterval(taiex[1600:1605]) -#tmp = quan#treg.QuantileRegression("") -#tmp.train(taiex[:1600], None, order=2) -#teste = tmp.forecast(taiex[1600:1605]) +""" +tmp = quantreg.QuantileRegression("", alpha=0.25) +tmp.train(taiex[:1600], None, order=1) +teste = tmp.forecastInterval(taiex[1600:1605]) -#print(taiex[1600:1605]) -#print(teste) +print(taiex[1600:1605]) +print(teste) +kk = Measures.get_interval_statistics(taiex[1600:1605], tmp) + +print(kk) +""" #bchmk.teste(taiex,['192.168.0.109', '192.168.0.101']) diff = Transformations.Differential(1) @@ -89,6 +94,7 @@ bchmk.point_sliding_window(sonda, 9000, train=0.8, inc=0.4, #models=[yu.Weighted partitions= np.arange(3,20,step=2), #transformation=diff, dump=True, save=True, file="experiments/sondaws_point_analytic_diff.csv", nodes=['192.168.0.103', '192.168.0.106', '192.168.0.108', '192.168.0.109']) #, depends=[hofts, ifts]) +""" #""" bchmk.interval_sliding_window(nasdaq, 2000, train=0.8, inc=0.1,#models=[yu.WeightedFTS], # # @@ -105,6 +111,8 @@ bchmk.interval_sliding_window(nasdaq, 2000, train=0.8, inc=0.1, #models=[yu.Weig dump=True, save=True, file="experiments/nasdaq_interval_analytic_diff.csv", nodes=['192.168.0.103', '192.168.0.106', '192.168.0.108', '192.168.0.109']) #, depends=[hofts, ifts]) +#""" + """ from pyFTS.partitioners import Grid from pyFTS import pwfts @@ -123,4 +131,4 @@ x = tmp.forecastInterval(taiex[1600:1610]) print(taiex[1600:1610]) print(x) -""" \ No newline at end of file +#""" \ No newline at end of file