investigations on Bruno vs. talweg: a shift overved, and neighbors differ (a bit...
authorBenjamin Auder <benjamin.auder@somewhere>
Wed, 3 May 2017 21:18:11 +0000 (23:18 +0200)
committerBenjamin Auder <benjamin.auder@somewhere>
Wed, 3 May 2017 21:18:11 +0000 (23:18 +0200)
Etude_En_Cours_R_E_bis.R
pkg/DESCRIPTION
pkg/R/F_Neighbors.R

index 457cf79..1fe1387 100644 (file)
@@ -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="")
index 3aab84c..0aed5da 100644 (file)
@@ -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'
index 60eb7b7..d63c177 100644 (file)
@@ -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))
        })
 }