- Several bugfixes in benchmarks methods and optimizations
This commit is contained in:
parent
38a1410b16
commit
8df4f9c749
@ -24,11 +24,11 @@ class ARIMA(fts.FTS):
|
|||||||
self.benchmark_only = True
|
self.benchmark_only = True
|
||||||
self.min_order = 1
|
self.min_order = 1
|
||||||
|
|
||||||
def train(self, data, sets, order=(2,1,1), parameters=None):
|
def train(self, data, sets, order, parameters=None):
|
||||||
self.p = order[0]
|
self.p = order[0]
|
||||||
self.d = order[1]
|
self.d = order[1]
|
||||||
self.q = order[2]
|
self.q = order[2]
|
||||||
self.order = max([self.p, self.d, self.q])
|
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) + ")"
|
||||||
|
|
||||||
old_fit = self.model_fit
|
old_fit = self.model_fit
|
||||||
@ -51,13 +51,19 @@ class ARIMA(fts.FTS):
|
|||||||
|
|
||||||
ret = []
|
ret = []
|
||||||
|
|
||||||
|
if self.d == 0:
|
||||||
ar = np.array([self.ar(ndata[k - self.p: k]) for k in np.arange(self.p, l)])
|
ar = np.array([self.ar(ndata[k - self.p: k]) for k in np.arange(self.p, l)])
|
||||||
|
else:
|
||||||
|
ar = np.array([ndata[k] + self.ar(ndata[k - self.p: k]) for k in np.arange(self.p, l)])
|
||||||
|
|
||||||
residuals = np.array([ar[k - self.p] - ndata[k] for k in np.arange(self.p, l)])
|
if self.q > 0:
|
||||||
|
residuals = np.array([ndata[k] - ar[k - self.p] for k in np.arange(self.p, l)])
|
||||||
|
|
||||||
ma = np.array([self.ma(residuals[k - self.q: k]) for k in np.arange(self.q, len(ar) + 1)])
|
ma = np.array([self.ma(residuals[k - self.q: k]) for k in np.arange(self.q, len(residuals))])
|
||||||
|
|
||||||
ret = ar + ma
|
ret = ar[self.q:] + ma
|
||||||
|
else:
|
||||||
|
ret = ar
|
||||||
|
|
||||||
ret = self.doInverseTransformations(ret, params=[data[self.order - 1:]])
|
ret = self.doInverseTransformations(ret, params=[data[self.order - 1:]])
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ def point_sliding_window(data, windowsize, train=0.8, models=None, partitioners=
|
|||||||
quantreg.QuantileRegression, quantreg.QuantileRegression]
|
quantreg.QuantileRegression, quantreg.QuantileRegression]
|
||||||
|
|
||||||
if benchmark_models_parameters is None:
|
if benchmark_models_parameters is None:
|
||||||
benchmark_models_parameters = [None, (1, 0, 1), (1, 1, 1), (2, 1, 1), (2, 1, 2), 1, 2]
|
benchmark_models_parameters = [None, (1, 0, 0), (1, 0, 1), (2, 0, 1), (2, 0, 2), 1, 2]
|
||||||
|
|
||||||
cluster = dispy.JobCluster(run_point, nodes=nodes) #, depends=dependencies)
|
cluster = dispy.JobCluster(run_point, nodes=nodes) #, depends=dependencies)
|
||||||
|
|
||||||
|
@ -64,9 +64,14 @@ from pyFTS.benchmarks import arima, quantreg
|
|||||||
#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],(2,1,1))
|
#tmp.train(taiex[:1600], None, order=(1,0,1))
|
||||||
#teste = tmp.forecast(taiex[1600:2000])
|
#teste = tmp.forecast(taiex[1600:1610])
|
||||||
|
|
||||||
|
#tmp = quantreg.QuantileRegression("")
|
||||||
|
#tmp.train(taiex[:1600], None, order=1)
|
||||||
|
#teste = tmp.forecast(taiex[1600:1610])
|
||||||
|
|
||||||
|
#print(taiex[1600:1610])
|
||||||
#print(teste)
|
#print(teste)
|
||||||
|
|
||||||
#bchmk.teste(taiex,['192.168.0.109', '192.168.0.101'])
|
#bchmk.teste(taiex,['192.168.0.109', '192.168.0.101'])
|
||||||
@ -75,7 +80,7 @@ bchmk.point_sliding_window(taiex,2000,train=0.8, #models=[yu.WeightedFTS], # #
|
|||||||
partitioners=[Grid.GridPartitioner], #Entropy.EntropyPartitioner], # FCM.FCMPartitioner, ],
|
partitioners=[Grid.GridPartitioner], #Entropy.EntropyPartitioner], # FCM.FCMPartitioner, ],
|
||||||
partitions= np.arange(10,200,step=10), #transformation=diff,
|
partitions= np.arange(10,200,step=10), #transformation=diff,
|
||||||
dump=True, save=True, file="experiments/taiex_point_analytic.csv",
|
dump=True, save=True, file="experiments/taiex_point_analytic.csv",
|
||||||
nodes=['192.168.0.102', '192.168.0.109']) #, depends=[hofts, ifts])
|
nodes=['192.168.0.102', '192.168.0.109', '192.168.0.106']) #, depends=[hofts, ifts])
|
||||||
|
|
||||||
#bchmk.testa(taiex,[10,20],partitioners=[Grid.GridPartitioner], nodes=['192.168.0.109', '192.168.0.101'])
|
#bchmk.testa(taiex,[10,20],partitioners=[Grid.GridPartitioner], nodes=['192.168.0.109', '192.168.0.101'])
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user