Bugfixes
This commit is contained in:
parent
7d5dae21e8
commit
5563af3079
@ -276,6 +276,7 @@ def heavyside_cdf(bins, targets):
|
||||
df = pd.DataFrame(ret, columns=bins)
|
||||
return df
|
||||
|
||||
|
||||
def crps(targets, densities):
|
||||
'''
|
||||
Continuous Ranked Probability Score
|
||||
|
@ -393,14 +393,19 @@ class ProbabilisticWeightedFTS(ifts.IntervalFTS):
|
||||
return point <= lower_set.lower or point >= upper_set.upper
|
||||
|
||||
def forecast_ahead(self, data, steps, **kwargs):
|
||||
ret = [data[k] for k in np.arange(len(data) - self.order, len(data))]
|
||||
|
||||
for k in np.arange(self.order - 1, steps):
|
||||
l = len(data)
|
||||
|
||||
start = kwargs.get('start', self.order)
|
||||
|
||||
ret = data[start - self.order: start].tolist()
|
||||
|
||||
for k in np.arange(self.order, steps+self.order):
|
||||
|
||||
if self.__check_point_bounds(ret[-1]) :
|
||||
ret.append(ret[-1])
|
||||
else:
|
||||
mp = self.forecast([ret[x] for x in np.arange(k - self.order, k)], **kwargs)
|
||||
mp = self.forecast(ret[k - self.order: k], **kwargs)
|
||||
ret.append(mp[0])
|
||||
|
||||
return ret[self.order:]
|
||||
@ -422,8 +427,10 @@ class ProbabilisticWeightedFTS(ifts.IntervalFTS):
|
||||
sample = data[start - self.order: start]
|
||||
|
||||
ret = [[k, k] for k in sample]
|
||||
|
||||
ret.append(self.forecast_interval(sample)[0])
|
||||
|
||||
for k in np.arange(self.order, steps+self.order):
|
||||
for k in np.arange(self.order+1, steps+self.order):
|
||||
|
||||
if len(ret) > 0 and self.__check_interval_bounds(ret[-1]):
|
||||
ret.append(ret[-1])
|
||||
|
@ -50,7 +50,7 @@ bchmk.sliding_window_benchmarks(dataset, 1000, train=0.8, inc=0.2,
|
||||
progress=False, type="point",
|
||||
#steps_ahead=[1,2,4,6,8,10],
|
||||
distributed=True, nodes=['192.168.0.110', '192.168.0.107', '192.168.0.106'],
|
||||
file="benchmarks.db", dataset="NASDAQ", tag="comparisons")
|
||||
file="benchmarks.db", dataset="TAIEX", tag="comparisons")
|
||||
|
||||
|
||||
|
||||
@ -80,7 +80,7 @@ print(Measures.get_distribution_statistics(dataset[800:1000], model, steps_ahead
|
||||
'''
|
||||
#'''
|
||||
|
||||
types = ['interval']#['point','interval','distribution']
|
||||
types = ['point','interval','distribution']
|
||||
benchmark_methods=[[arima.ARIMA for k in range(8)] + [quantreg.QuantileRegression for k in range(4)]]
|
||||
'''
|
||||
benchmark_methods=[
|
||||
@ -136,33 +136,37 @@ benchmark_methods_parameters= [
|
||||
]
|
||||
]'''
|
||||
dataset_name = "SP500"
|
||||
tag = "comparisons"
|
||||
tag = "ahead2"
|
||||
|
||||
from pyFTS.benchmarks import arima, naive, quantreg
|
||||
|
||||
for ct, type in enumerate(types):
|
||||
|
||||
bchmk.sliding_window_benchmarks(dataset, 1000, train=0.8, inc=0.2,
|
||||
benchmark_models=True,
|
||||
benchmark_methods=benchmark_methods[ct],
|
||||
benchmark_methods_parameters=benchmark_methods_parameters[ct],
|
||||
transformations=[None],
|
||||
orders=[1,2,3],
|
||||
partitions=np.arange(15, 85, 5),
|
||||
progress=False, type=type,
|
||||
distributed=True, nodes=['192.168.0.110', '192.168.0.107','192.168.0.106'],
|
||||
file="benchmarks.db", dataset=dataset_name, tag=tag)
|
||||
|
||||
bchmk.sliding_window_benchmarks(dataset, 1000, train=0.8, inc=0.2,
|
||||
benchmark_models=True,
|
||||
benchmark_methods=benchmark_methods[ct],
|
||||
benchmark_methods_parameters=benchmark_methods_parameters[ct],
|
||||
methods=[pwfts.ProbabilisticWeightedFTS],
|
||||
benchmark_models=False,
|
||||
#benchmark_methods=benchmark_methods[ct],
|
||||
#benchmark_methods_parameters=benchmark_methods_parameters[ct],
|
||||
transformations=[tdiff],
|
||||
orders=[1, 2, 3],
|
||||
partitiTAIEXons=np.arange(3, 35, 2),
|
||||
orders=[1], #, 2, 3],
|
||||
partitions=[5], #np.arange(3, 35, 2),
|
||||
progress=False, type=type,
|
||||
steps_ahead=[2, 4, 6, 8, 10],
|
||||
distributed=True, nodes=['192.168.0.110', '192.168.0.107', '192.168.0.106'],
|
||||
file="benchmarks.db", dataset=dataset_name, tag=tag)
|
||||
bchmk.sliding_window_benchmarks(dataset, 1000, train=0.8, inc=0.2,
|
||||
methods=[pwfts.ProbabilisticWeightedFTS],
|
||||
benchmark_models=False,
|
||||
#benchmark_methods=benchmark_methods[ct],
|
||||
#benchmark_methods_parameters=benchmark_methods_parameters[ct],
|
||||
transformations=[None],
|
||||
orders=[1], #,2,3],
|
||||
partitions=[30], #np.arange(15, 85, 5),
|
||||
progress=False, type=type,
|
||||
steps_ahead=[2, 4, 6, 8, 10],
|
||||
distributed=True, nodes=['192.168.0.110', '192.168.0.107','192.168.0.106'],
|
||||
file="benchmarks.db", dataset=dataset_name, tag=tag)
|
||||
|
||||
|
||||
#'''
|
||||
|
Loading…
Reference in New Issue
Block a user