From: Benjamin Auder Date: Wed, 29 Mar 2017 11:39:04 +0000 (+0200) Subject: attempt to fix F_Neighbors2 X-Git-Url: https://git.auder.net/doc/html/vendor/img/logo_Westcastle.png?a=commitdiff_plain;h=9003747badc4416d68cab45ff17de3ecea327942;p=talweg.git attempt to fix F_Neighbors2 --- diff --git a/.gitignore b/.gitignore index 2ee5d86..030f5d7 100644 --- a/.gitignore +++ b/.gitignore @@ -19,8 +19,9 @@ NAMESPACE *.[oa] *.so -#jupyter checkpoints + generated HTML +#jupyter checkpoints + generated ipynb,html .ipynb_checkpoints/ +/reports/*.ipynb /reports/*.html #large CSV files diff --git a/pkg/R/F_Neighbors2.R b/pkg/R/F_Neighbors2.R index 60916b4..ee40f61 100644 --- a/pkg/R/F_Neighbors2.R +++ b/pkg/R/F_Neighbors2.R @@ -46,8 +46,7 @@ Neighbors2Forecaster = R6::R6Class("Neighbors2Forecaster", if (!is.na(prediction[1])) { nb_jours = nb_jours + 1 - error = error + - mean((data$getCenteredSerie(cv_days[i]+1)[1:horizon] - prediction)^2) + error = error + mean((data$getSerie(cv_days[i]+1)[1:horizon] - prediction)^2) } } return (error / nb_jours) @@ -207,10 +206,11 @@ Neighbors2Forecaster = R6::R6Class("Neighbors2Forecaster", prediction = rep(0, horizon) for (i in seq_along(fdays)) - prediction = prediction + similarities[i] * data$getCenteredSerie(fdays[i]+1)[1:horizon] + prediction = prediction + similarities[i] * data$getSerie(fdays[i]+1)[1:horizon] if (final_call) { + prediction = prediction - mean(prediction) #predict centered serie (artificial...) private$.params$weights <- similarities private$.params$indices <- fdays private$.params$window <- diff --git a/reports/run.sh b/reports/run.sh old mode 100644 new mode 100755