View source: R/cali_ensemble.R
cali_ensemble | R Documentation |
Use one of three methods to calibrate specified models.
cali_ensemble(
config_file,
num = NULL,
param_file = NULL,
cmethod = "LHC",
qualfun = qual_fun,
parallel = FALSE,
job_name,
model = c("FLake", "GLM", "GOTM", "Simstrat", "MyLake"),
folder = ".",
spin_up = NULL,
out_f = "cali",
ncores = NULL,
tmp_dir = NULL,
...
)
config_file |
file path; to LakeEnsemblr yaml master config file |
num |
integer; the number of random parameter sets to generate. If param file is provided num = number of parameters in that file. |
param_file |
file path; to previously created parameter file set. If NULL creates a new parameter set. Defaults to NULL |
cmethod |
character; Method for calibration. Can be "LHC", "LHC_old, "MCMC" or "modFit". Defaults to "LHC". LHC and LHC_old only differ in the way the parallelization is set up, whereas the new and default LHC version is more efficient and LHC_old is only kept for possible backwards compatibility. |
qualfun |
function; function that calculates measure of fit from observed and simulated variables, takes the two arguments Observed and Simulated |
parallel |
Boolean; should the model calibration be parallelized |
job_name |
character; optional name to use as an RStudio job and as output variable name. It has to be a syntactically valid name. Check out this webpage for more info on jobs: https://blog.rstudio.com/2019/03/14/rstudio-1-2-jobs/ |
model |
vector; model to export driving data. Options include c("GOTM", "GLM", "Simstrat", "FLake", "MyLake") |
folder |
file path; to folder which contains the model folders generated by export_config() |
spin_up |
numeric; Number of days to disregard as spin-up for analysis. |
out_f |
character; name of the folder to store results into |
ncores |
numeric; number of cores to be used. If NULL, will default to 'parallel::detectCores() - 1'. |
tmp_dir |
location where the temporary files for LHC calibration in parallel are stored |
... |
additional arguments passed to FME::modFit or FME::modMCMC. Only used when method is modFit or MCMC |
Parallelisation is done using the 'parallel' package and 'parLapply()'. The number of cores used is set to the value specified in 'ncores'.
## Not run:
config_file <- 'LakeEnsemblR.yaml'
# LHC method
cali_ensemble(config_file = config_file, num = 200, cmethod = "LHC",
model = c("FLake", "GLM", "GOTM", "Simstrat", "MyLake"))
# MCMC method
resMCMC <- cali_ensemble(config_file = config_file, num = 200, cmethod = "MCMC",
model = c("FLake", "GLM", "GOTM", "Simstrat", "MyLake"))
# modFit method using the Nelder-Mead algorithm
resMmodFit <- cali_ensemble(config_file = config_file, num = 200, cmethod = "modFit",
model = c("FLake", "GLM", "GOTM", "Simstrat", "MyLake"),
method = "Nelder-Mead")
# LHC method using multiple cores
cali_ensemble(config_file = config_file, num = 200, cmethod = "LHC",
model = c("FLake", "GLM", "GOTM", "Simstrat", "MyLake"),
parallel = TRUE)
# LHC method deployed as a job
cali_ensemble(config_file = config_file, num = 200, cmethod = "LHC",
model = c("FLake", "GLM", "GOTM", "Simstrat", "MyLake"),
job_name = "test")
test # View output from job
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.