X-Git-Url: https://git.auder.net/?p=talweg.git;a=blobdiff_plain;f=pkg%2FR%2FF_Neighbors.R;h=c8a33554f92fef75dc327fb526faea9027b4b535;hp=d889a34ce64b82c51889a5a81322a1a7dec25b2c;hb=6774e53de7b8bdac191d6203a380ad46c3b4d9ba;hpb=ee8b1b4e3c13f8dcf13a2c8da6a3bef1520c8252 diff --git a/pkg/R/F_Neighbors.R b/pkg/R/F_Neighbors.R index d889a34..c8a3355 100644 --- a/pkg/R/F_Neighbors.R +++ b/pkg/R/F_Neighbors.R @@ -30,12 +30,8 @@ NeighborsForecaster = R6::R6Class("NeighborsForecaster", fdays, today, horizon, list(...)$h_window, kernel, simtype, TRUE) ) } - # Indices of similar days for cross-validation; TODO: 45 = magic number - sdays = getSimilarDaysIndices(today, data, limit=45, same_season=FALSE) - - cv_days = intersect(fdays,sdays) - # Limit to 20 most recent matching days (TODO: 20 == magic number) - cv_days = sort(cv_days,decreasing=TRUE)[1:min(20,length(cv_days))] + # Indices of similar days for cross-validation; TODO: 20 = magic number + cv_days = getSimilarDaysIndices(today, data, limit=20, same_season=FALSE, days_in=fdays) # Function to optimize h : h |--> sum of prediction errors on last 45 "similar" days errorOnLastNdays = function(h, kernel, simtype)