- Bugfix on interval forecast of quantreg
This commit is contained in:
parent
8bc4b966b6
commit
a0f49ea151
@ -33,7 +33,7 @@ class ARIMA(fts.FTS):
|
|||||||
self.d = order[1]
|
self.d = order[1]
|
||||||
self.q = order[2]
|
self.q = order[2]
|
||||||
self.order = self.p + 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) + ") - " + str(self.alpha)
|
||||||
|
|
||||||
old_fit = self.model_fit
|
old_fit = self.model_fit
|
||||||
try:
|
try:
|
||||||
|
@ -41,7 +41,7 @@ class QuantileRegression(fts.FTS):
|
|||||||
self.upper_qt = [k for k in uqt.params]
|
self.upper_qt = [k for k in uqt.params]
|
||||||
self.lower_qt = [k for k in lqt.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):
|
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) ])
|
||||||
@ -74,7 +74,7 @@ class QuantileRegression(fts.FTS):
|
|||||||
sample = ndata[k - self.order: k]
|
sample = ndata[k - self.order: k]
|
||||||
up = self.linearmodel(sample, self.upper_qt)
|
up = self.linearmodel(sample, self.upper_qt)
|
||||||
down = self.linearmodel(sample, self.lower_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)
|
ret = self.doInverseTransformations(ret, params=[data[self.order - 1:]], interval=True)
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ nasdaq = np.array(nasdaqpd["avg"][0:5000])
|
|||||||
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, 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)
|
#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))
|
#tmp.train(taiex[:1600], None, order=(2,0,2))
|
||||||
#teste = tmp.forecastInterval(taiex[1600:1605])
|
#teste = tmp.forecastInterval(taiex[1600:1605])
|
||||||
|
|
||||||
#tmp = quan#treg.QuantileRegression("")
|
"""
|
||||||
#tmp.train(taiex[:1600], None, order=2)
|
tmp = quantreg.QuantileRegression("", alpha=0.25)
|
||||||
#teste = tmp.forecast(taiex[1600:1605])
|
tmp.train(taiex[:1600], None, order=1)
|
||||||
|
teste = tmp.forecastInterval(taiex[1600:1605])
|
||||||
|
|
||||||
#print(taiex[1600:1605])
|
print(taiex[1600:1605])
|
||||||
#print(teste)
|
print(teste)
|
||||||
|
|
||||||
|
kk = Measures.get_interval_statistics(taiex[1600:1605], tmp)
|
||||||
|
|
||||||
|
print(kk)
|
||||||
|
"""
|
||||||
#bchmk.teste(taiex,['192.168.0.109', '192.168.0.101'])
|
#bchmk.teste(taiex,['192.168.0.109', '192.168.0.101'])
|
||||||
|
|
||||||
diff = Transformations.Differential(1)
|
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,
|
partitions= np.arange(3,20,step=2), #transformation=diff,
|
||||||
dump=True, save=True, file="experiments/sondaws_point_analytic_diff.csv",
|
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])
|
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], # #
|
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",
|
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])
|
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.partitioners import Grid
|
||||||
from pyFTS import pwfts
|
from pyFTS import pwfts
|
||||||
@ -123,4 +131,4 @@ x = tmp.forecastInterval(taiex[1600:1610])
|
|||||||
|
|
||||||
print(taiex[1600:1610])
|
print(taiex[1600:1610])
|
||||||
print(x)
|
print(x)
|
||||||
"""
|
#"""
|
Loading…
Reference in New Issue
Block a user