Skip to contents

The write_model function (opposed to the write_output) is a generic wrapper to writing a DistributionModel to disk. It is essentially a wrapper to saveRDS. Models can be loaded again via the load_model function.

Usage

write_model(
  mod,
  fname,
  slim = FALSE,
  verbose = getOption("ibis.setupmessages", default = TRUE)
)

# S4 method for class 'ANY'
write_model(
  mod,
  fname,
  slim = FALSE,
  verbose = getOption("ibis.setupmessages", default = TRUE)
)

Arguments

mod

Provided DistributionModel object.

fname

A character depicting an output filename.

slim

A logical option to whether unnecessary entries in the model object should be deleted. This deletes for example predictions or any other non-model content from the object (Default: FALSE).

verbose

logical indicating whether messages should be shown. Overwrites getOption("ibis.setupmessages") (Default: TRUE).

Value

No R-output is created. A file is written to the target direction.

Note

By default output files will be overwritten if already existing!

See also

load_model

Examples

if (FALSE) { # \dontrun{
x <- distribution(background) |>
 add_biodiversity_poipo(virtual_points, field_occurrence = 'observed', name = 'Virtual points') |>
 add_predictors(pred_current, transform = 'scale',derivates = 'none') |>
 engine_xgboost(nrounds = 2000) |> train(varsel = FALSE, only_linear = TRUE)
write_model(x, "testmodel.rds")
} # }