X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=pkg%2FR%2FF_Neighbors.R;h=600c5c8ceeaae272a824a259c36f5075662c4b78;hb=5c49f6cecd547358b327e9363e62bcc8219e9e33;hp=a3d44a3916cc8b27195ddd693fc35f6dbcceb2b1;hpb=546b0cb65870355a2a2c3705c91418570499d3a6;p=talweg.git diff --git a/pkg/R/F_Neighbors.R b/pkg/R/F_Neighbors.R index a3d44a3..600c5c8 100644 --- a/pkg/R/F_Neighbors.R +++ b/pkg/R/F_Neighbors.R @@ -103,12 +103,12 @@ NeighborsForecaster = R6::R6Class("NeighborsForecaster", # Require at least half of non-NA common values to compute the distance if ( !any( is.na(delta) ) ) distances2[i] = mean(delta^2) - } + Centered} sd_dist = sd(distances2) if (sd_dist < .Machine$double.eps) { - warning("All computed distances are very close: stdev too small") +# warning("All computed distances are very close: stdev too small") sd_dist = 1 #mostly for tests... FIXME: } simils_endo = @@ -146,7 +146,7 @@ NeighborsForecaster = R6::R6Class("NeighborsForecaster", sd_dist = sd(distances2) if (sd_dist < .Machine$double.eps) { - warning("All computed distances are very close: stdev too small") +# warning("All computed distances are very close: stdev too small") sd_dist = 1 #mostly for tests... FIXME: } simils_exo = @@ -171,7 +171,7 @@ NeighborsForecaster = R6::R6Class("NeighborsForecaster", prediction = rep(0, horizon) for (i in seq_along(fdays)) - prediction = prediction + similarities[i] * data$getSerie(fdays[i]+1)[1:horizon] + prediction = prediction + similarities[i] * data$getCenteredSerie(fdays[i]+1)[1:horizon] prediction = prediction / sum(similarities, na.rm=TRUE) if (final_call)