some last fixes; results still not good...
authorBenjamin Auder <benjamin.auder@somewhere>
Wed, 26 Apr 2017 16:07:39 +0000 (18:07 +0200)
committerBenjamin Auder <benjamin.auder@somewhere>
Wed, 26 Apr 2017 16:07:39 +0000 (18:07 +0200)
pkg/R/J_Neighbors.R
pkg/R/plot.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)] )
index 2b74117..465b606 100644 (file)
@@ -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)