ROI Transformation; Naïve forecaster; Theil's U Statistic

This commit is contained in:
Petrônio Cândido de Lima e Silva 2017-01-23 09:26:33 -02:00
parent 72610e9dc3
commit 30ffb89465

View File

@ -26,12 +26,11 @@ def mape_interval(targets, forecasts):
# Theil's U Statistic
def U(targets, forecasts):
#forecasts.insert(0,None)
l = len(targets)
naive = []
y = []
for k in np.arange(0,l-1):
y.append(((targets[k+1]-forecasts[k])/targets[k]) ** 2)
y.append(((forecasts[k] - targets[k+1])/targets[k]) ** 2)
naive.append(((targets[k + 1] - targets[k]) / targets[k]) ** 2)
return np.sqrt(sum(y)/sum(naive))