RAnEnExtra::weightSearch is a grid search function for weight optimization.
weightSearch( weights, forecasts, observations, test.times, search.times, config, metric = "RMSE", return.best.only = F, combine.weights = T, ... )
| weights | Either a numeric matrix or a single numeral. If it is a matrix, each row is a certain weight combination and the number of rows equal to the number of iterations; if it is a single numeral, it is the number of iterations and the weights will be randomly generated. |
|---|---|
| forecasts | Forecasts for |
| observations | Observations for |
| test.times | Test times for |
| search.times | Search times for |
| config | Config for |
| metric | This can either be a function or a metric for |
| return.best.only | Whether to only return the best combination of weights |
| combine.weights | Whether to combine errors as an extra column to weight matrix. This does not work when |
| ... | Extra parameters for metric if it is a function |
Either a vector or a matrix. If a vector is returned, it is the best combination of weights; if a matrix is returned, it is the combinations of weights that have been searched and the last column is the verification metric.