Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
onlineforecast
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
packages
onlineforecast
Commits
f13231e0
Commit
f13231e0
authored
3 years ago
by
pbac
Browse files
Options
Downloads
Patches
Plain Diff
maybe final 0.10.0
parent
d91dc56d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
R/step_optim.R
+10
-7
10 additions, 7 deletions
R/step_optim.R
man/step_optim.Rd
+10
-7
10 additions, 7 deletions
man/step_optim.Rd
with
20 additions
and
14 deletions
R/step_optim.R
+
10
−
7
View file @
f13231e0
...
...
@@ -122,19 +122,20 @@
#' # Select a model, in the optimization just run it for a single horizon
#' # Note that kseqopt could also be set
#' model$kseq <- 5
#' #
#'
#' # Set the parameters to step on, note the
#' prm <- list(mu_tday__nharmonics = c(min=3, max=7))
#'
#' # Note the control argument, which is passed to optim, it's now set to few
#' #
I
terations in the
prm
optimization (MUST be increased in real applications)
#' #
i
terations in the
offline parameter
optimization (MUST be increased in real applications)
#' control <- list(maxit=1)
#'
#' # On Windows multi cores are not supported, so for the examples use only one
#' # On Windows multi cores are not supported, so for the examples use only one
core
#' mc.cores <- 1
#'
#' # Run the default selection scheme, which is "both"
#' # (same as "backwardboth" if no start model is given)
#' L <- step_optim(model, D, prm, control=control, mc.cores=mc.cores)
#'
\donttest{
L <- step_optim(model, D, prm, control=control, mc.cores=mc.cores)
#'
#' # The optim value from each step is returned
#' getse(L, "optimresult")
...
...
@@ -157,8 +158,10 @@
#' modelstart$inputs[2:3] <- NULL
#' L <- step_optim(model, D, prm, modelstart=modelstart, control=control, mc.cores=mc.cores)
#'
#' # If a fitting function is given, then it will be used for calculating the forecasts
#' # ONLY on the complete cases in each step
#' # If a fitting function is given, then it will be used for calculating the forecasts.
#' # Below it's the rls_fit function, so the same as used internally in rls_fit, so only
#' # difference is that now ONLY on the complete cases for all models in each step are used
#' # when calculating the score in each step
#' L1 <- step_optim(model, D, prm, fitfun=rls_fit, control=control, mc.cores=mc.cores)
#'
#' # The easiest way to conclude if missing values have an influence is to
...
...
@@ -168,7 +171,7 @@
#' # Compare the selected models
#' tmp1 <- capture.output(getse(L1, "model"))
#' tmp2 <- capture.output(getse(L2, "model"))
#' identical(tmp1, tmp2)
#' identical(tmp1, tmp2)
}
#'
#'
#' # Note that caching can be really smart (the cache files are located in the
...
...
This diff is collapsed.
Click to expand it.
man/step_optim.Rd
+
10
−
7
View file @
f13231e0
...
...
@@ -151,19 +151,20 @@ model$add_prmbounds(lambda = c(0.9, 0.99, 0.9999))
# Select a model, in the optimization just run it for a single horizon
# Note that kseqopt could also be set
model$kseq <- 5
#
# Set the parameters to step on, note the
prm <- list(mu_tday__nharmonics = c(min=3, max=7))
# Note the control argument, which is passed to optim, it's now set to few
#
I
terations in the
prm
optimization (MUST be increased in real applications)
#
i
terations in the
offline parameter
optimization (MUST be increased in real applications)
control <- list(maxit=1)
# On Windows multi cores are not supported, so for the examples use only one
# On Windows multi cores are not supported, so for the examples use only one
core
mc.cores <- 1
# Run the default selection scheme, which is "both"
# (same as "backwardboth" if no start model is given)
L <- step_optim(model, D, prm, control=control, mc.cores=mc.cores)
\donttest{
L <- step_optim(model, D, prm, control=control, mc.cores=mc.cores)
# The optim value from each step is returned
getse(L, "optimresult")
...
...
@@ -186,8 +187,10 @@ modelstart <- model$clone_deep()
modelstart$inputs[2:3] <- NULL
L <- step_optim(model, D, prm, modelstart=modelstart, control=control, mc.cores=mc.cores)
# If a fitting function is given, then it will be used for calculating the forecasts
# ONLY on the complete cases in each step
# If a fitting function is given, then it will be used for calculating the forecasts.
# Below it's the rls_fit function, so the same as used internally in rls_fit, so only
# difference is that now ONLY on the complete cases for all models in each step are used
# when calculating the score in each step
L1 <- step_optim(model, D, prm, fitfun=rls_fit, control=control, mc.cores=mc.cores)
# The easiest way to conclude if missing values have an influence is to
...
...
@@ -197,7 +200,7 @@ L2 <- step_optim(model, D, prm, control=control, mc.cores=mc.cores)
# Compare the selected models
tmp1 <- capture.output(getse(L1, "model"))
tmp2 <- capture.output(getse(L2, "model"))
identical(tmp1, tmp2)
identical(tmp1, tmp2)
}
# Note that caching can be really smart (the cache files are located in the
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment