naive searches historical windows for recurring patterns
and uses similar windows to form an empirical forecast distribution. The
runtime package uses only base R.
set.seed(1)
x <- data.frame(signal = sin(seq(0, 12, length.out = 120)) + rnorm(120, 0, .05))
fit <- naive_fit(x, seq_len = 8, n_windows = 3, n_samp = 4, seed = 42)
print(fit)
#> naive empirical forecast
#> horizon: 8
#> seq_len cover stride method location score
#> 1 8 0.8318448 2 euclidean mean 0.9311625
#> 2 8 0.8496603 4 minkowski median 0.9253822
#> 3 8 0.3289116 2 minkowski median 0.9311625
#> 4 8 0.7643581 2 euclidean median 0.9311625
plot(fit)The same interface accepts categorical sequences.
events <- data.frame(state = factor(rep(c("low", "high", "medium"), 30)))
naive_forecast(events, horizon = 4, seed = 42)$forecast$state
#> mode
#> 1 high
#> 2 high
#> 3 high
#> 4 highUse naive_metrics() to compare a forecast against a
holdout and compare the result with a last-value baseline before
deploying it.
Need a high-speed mirror for your open-source project?
Contact our mirror admin team at info@clientvps.com.
This archive is provided as a free public service to the community.
Proudly supported by infrastructure from VPSPulse , RxServers , BuyNumber , UnitVPS , OffshoreName and secure payment technology by ArionPay.