From: Benjamin Auder <benjamin.auder@somewhere>
Date: Wed, 26 Apr 2017 16:07:39 +0000 (+0200)
Subject: some last fixes; results still not good...
X-Git-Url: https://git.auder.net/variants/img/current/assets/DESCRIPTION?a=commitdiff_plain;h=9e0f25f6d5c73008c0ad59ea7b7e097b342f26b3;p=talweg.git

some last fixes; results still not good...
---

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)