attempt to fix F_Neighbors2
authorBenjamin Auder <benjamin.auder@somewhere>
Wed, 29 Mar 2017 11:39:04 +0000 (13:39 +0200)
committerBenjamin Auder <benjamin.auder@somewhere>
Wed, 29 Mar 2017 11:39:04 +0000 (13:39 +0200)
.gitignore
pkg/R/F_Neighbors2.R
reports/run.sh [changed mode: 0644->0755]

index 2ee5d86..030f5d7 100644 (file)
@@ -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
index 60916b4..ee40f61 100644 (file)
@@ -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 <-
old mode 100644 (file)
new mode 100755 (executable)