some last fixes; results still not good...
[talweg.git] / pkg / R / J_Neighbors.R
index 58453ea..2caedc5 100644 (file)
@@ -20,9 +20,9 @@ getNeighborsJumpPredict = function(data, today, memory, predict_from, horizon,
 
        gaps = sapply(indices, function(i) {
                if (predict_from >= 2)
-                       data$getSerie(i+1)[predict_from] - data$getSerie(i+1)[predict_from-1]
+                       data$getSerie(i)[predict_from] - data$getSerie(i)[predict_from-1]
                else
-                       head(data$getSerie(i+1),1) - tail(data$getSerie(i),1)
+                       head(data$getSerie(i),1) - tail(data$getSerie(i-1),1)
        })
        scal_product = weights * gaps
        norm_fact = sum( weights[!is.na(scal_product)] )