From 9e0f25f6d5c73008c0ad59ea7b7e097b342f26b3 Mon Sep 17 00:00:00 2001
From: Benjamin Auder <benjamin.auder@somewhere>
Date: Wed, 26 Apr 2017 18:07:39 +0200
Subject: [PATCH] some last fixes; results still not good...

---
 pkg/R/J_Neighbors.R | 4 ++--
 pkg/R/plot.R        | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/pkg/R/J_Neighbors.R b/pkg/R/J_Neighbors.R
index 58453ea..2caedc5 100644
--- a/pkg/R/J_Neighbors.R
+++ b/pkg/R/J_Neighbors.R
@@ -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)] )
diff --git a/pkg/R/plot.R b/pkg/R/plot.R
index 2b74117..465b606 100644
--- a/pkg/R/plot.R
+++ b/pkg/R/plot.R
@@ -172,8 +172,8 @@ computeFilaments <- function(data, pred, index, predict_from, limit=60, plot=TRU
 		ref_serie = c( data$getCenteredSerie( pred$getIndexInData(index)-1 ),
 			data$getCenteredSerie( pred$getIndexInData(index) ) )
 		centered_series = rbind(
-			data$getCenteredSeries( pred$getParams(index)$indices ),
-			data$getCenteredSeries( pred$getParams(index)$indices+1 ) )
+			data$getCenteredSeries( pred$getParams(index)$indices-1 ),
+			data$getCenteredSeries( pred$getParams(index)$indices ) )
 		yrange = range( ref_serie,
 			quantile(centered_series, probs=c(0.025,0.975), na.rm=TRUE) )
 		par(mar=c(4.7,5,1,1), cex.axis=1.5, cex.lab=1.5, lwd=2)
-- 
2.44.0