- Several bugfixes in benchmarks methods and optimizations

This commit is contained in:
Petrônio Cândido de Lima e Silva 2017-05-08 15:20:16 -03:00
parent 692503704e
commit 38a1410b16
5 changed files with 14 additions and 9 deletions

View File

@ -11,7 +11,7 @@ class ARIMA(fts.FTS):
Façade for statsmodels.tsa.arima_model Façade for statsmodels.tsa.arima_model
""" """
def __init__(self, name, **kwargs): def __init__(self, name, **kwargs):
super(ARIMA, self).__init__(1, "ARIMA") super(ARIMA, self).__init__(1, "ARIMA"+name)
self.name = "ARIMA" self.name = "ARIMA"
self.detail = "Auto Regressive Integrated Moving Average" self.detail = "Auto Regressive Integrated Moving Average"
self.is_high_order = True self.is_high_order = True

View File

@ -8,6 +8,7 @@ python3 /usr/local/bin/dispynode.py -i [local IP] -d
import datetime import datetime
import time import time
from copy import deepcopy
import dispy import dispy
import dispy.httpd import dispy.httpd
@ -136,8 +137,9 @@ def point_sliding_window(data, windowsize, train=0.8, models=None, partitioners=
pool.append(mfts) pool.append(mfts)
for count, model in enumerate(benchmark_models, start=0): for count, model in enumerate(benchmark_models, start=0):
mfts = model("") par = benchmark_models_parameters[count]
mfts.order = benchmark_models_parameters[count] mfts = model(str(par if par is not None else ""))
mfts.order = par
pool.append(mfts) pool.append(mfts)
experiments = 0 experiments = 0

View File

@ -7,7 +7,7 @@ from pyFTS import fts
class Naive(fts.FTS): class Naive(fts.FTS):
"""Naïve Forecasting method""" """Naïve Forecasting method"""
def __init__(self, name, **kwargs): def __init__(self, name, **kwargs):
super(Naive, self).__init__(1, "Naive " + name) super(Naive, self).__init__(1, "Naive")
self.name = "Naïve Model" self.name = "Naïve Model"
self.detail = "Naïve Model" self.detail = "Naïve Model"
self.benchmark_only = True self.benchmark_only = True

View File

@ -10,7 +10,7 @@ from pyFTS import fts
class QuantileRegression(fts.FTS): class QuantileRegression(fts.FTS):
"""Façade for statsmodels.regression.quantile_regression""" """Façade for statsmodels.regression.quantile_regression"""
def __init__(self, name, **kwargs): def __init__(self, name, **kwargs):
super(QuantileRegression, self).__init__(1, "QR") super(QuantileRegression, self).__init__(1, "QR"+name)
self.name = "QR" self.name = "QR"
self.detail = "Quantile Regression" self.detail = "Quantile Regression"
self.is_high_order = True 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.upper_qt = [uqt.params[k] for k in uqt.params.keys()]
self.lower_qt = [lqt.params[k] for k in lqt.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): 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): def forecast(self, data, **kwargs):
ndata = np.array(self.doTransformations(data)) ndata = np.array(self.doTransformations(data))

View File

@ -57,15 +57,15 @@ from statsmodels.tsa.tsatools import lagmat
from pyFTS.benchmarks import distributed_benchmarks as bchmk from pyFTS.benchmarks import distributed_benchmarks as bchmk
#from pyFTS.benchmarks import parallel_benchmarks as bchmk #from pyFTS.benchmarks import parallel_benchmarks as bchmk
from pyFTS.benchmarks import Util 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.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) #Util.plot_dataframe_point("experiments/taiex_point_sintetic.csv","experiments/taiex_point_analitic.csv",11)
#tmp = arima.ARIMA("") #tmp = arima.ARIMA("")
#tmp.train(taiex[:1600],None,parameters=(2,0,1)) #tmp.train(taiex[:1600],(2,1,1))
#teste = tmp.forecast(taiex[1598:1601]) #teste = tmp.forecast(taiex[1600:2000])
#print(teste) #print(teste)