From: Benjamin Auder <benjamin.auder@somewhere>
Date: Wed, 3 May 2017 21:18:11 +0000 (+0200)
Subject: investigations on Bruno vs. talweg: a shift overved, and neighbors differ (a bit... 
X-Git-Url: https://git.auder.net/variants/current/doc/css/common.css?a=commitdiff_plain;h=5037d6d061b86f7bc4baaf5c4614c6da9c9eaa1b;p=talweg.git

investigations on Bruno vs. talweg: a shift overved, and neighbors differ (a bit). Why?
---

diff --git a/Etude_En_Cours_R_E_bis.R b/Etude_En_Cours_R_E_bis.R
index 457cf79..1fe1387 100644
--- a/Etude_En_Cours_R_E_bis.R
+++ b/Etude_En_Cours_R_E_bis.R
@@ -106,6 +106,13 @@ Kvois = NULL
 #	w = 1/(D[ind]^2)
 #	w = w/sum(w)
 #	W = w %o% rep(1,48)
+
+print("Voisins + ij")
+print(sort(D)[1:nbvois])
+print(dateJPrev)
+print(rownames(data)[ind])
+print(data[ind, 1:48])
+
 	JourMoy = apply(data[ind, 1:48], 2, mean)
 	#JourMoy = apply(W*data[ind, 1:48], 2, sum)
 	NomFile = paste("Voisins_Epandage_PMjour_Hc_",Hc,".png",sep="")
diff --git a/pkg/DESCRIPTION b/pkg/DESCRIPTION
index 3aab84c..0aed5da 100644
--- a/pkg/DESCRIPTION
+++ b/pkg/DESCRIPTION
@@ -23,7 +23,7 @@ Suggests:
 LazyData: yes
 URL: http://git.auder.net/?p=talweg.git
 License: MIT + file LICENSE
-RoxygenNote: 5.0.1
+RoxygenNote: 6.0.1
 Collate:
     'plot.R'
     'computeError.R'
diff --git a/pkg/R/F_Neighbors.R b/pkg/R/F_Neighbors.R
index 60eb7b7..d63c177 100644
--- a/pkg/R/F_Neighbors.R
+++ b/pkg/R/F_Neighbors.R
@@ -146,12 +146,18 @@ NeighborsForecaster = R6::R6Class("NeighborsForecaster",
 					}
 					return ( data$getSerie(tdays[1])[predict_from:horizon] )
 				}
-				max_neighbs = 12 #TODO: 12 = arbitrary number
+				max_neighbs = 10 #TODO: 12 = arbitrary number
 				if (length(tdays) > max_neighbs)
 				{
 					distances2 <- .computeDistsEndo(data, today, tdays, predict_from)
 					ordering <- order(distances2)
 					tdays <- tdays[ ordering[1:max_neighbs] ]
+
+					print("VVVVV")
+					print(sort(distances2)[1:max_neighbs])
+					print(integerIndexToDate(today,data))
+					print(lapply(tdays,function(i) integerIndexToDate(i,data)))
+					print(rbind(data$getSeries(tdays-1), data$getSeries(tdays)))
 				}
 			}
 			else
@@ -281,7 +287,8 @@ NeighborsForecaster = R6::R6Class("NeighborsForecaster",
 	sapply(tdays, function(i) {
 		delta = lastSerie - c(data$getSerie(i-1),
 			data$getSerie(i)[if (predict_from>=2) 1:(predict_from-1) else c()])
-		sqrt(mean(delta^2))
+#		sqrt(mean(delta^2))
+		sqrt(sum(delta^2))
 	})
 }