Learn R Programming

ldmppr (version 1.1.0)

ldmppr_mark_model: Mark model object

Description

`ldmppr_mark_model` objects store a fitted mark model and preprocessing information used to predict marks at new locations and times.

Usage

ldmppr_mark_model(
  engine,
  fit_engine = NULL,
  xgb_raw = NULL,
  recipe = NULL,
  outcome = "size",
  feature_names = NULL,
  info = list()
)

# S3 method for ldmppr_mark_model print(x, ...)

# S3 method for ldmppr_mark_model predict(object, new_data, ...)

save_mark_model(object, path, ...)

# S3 method for ldmppr_mark_model save_mark_model(object, path, ...)

load_mark_model(path)

Value

* `print()` prints a brief summary. * `predict()` returns numeric predictions for new data.

an object of class `"ldmppr_mark_model"`.

Arguments

engine

Character scalar. One of `"xgboost"` or `"ranger"`.

fit_engine

Fitted engine object (e.g. `xgb.Booster` or a ranger fit).

xgb_raw

Raw xgboost payload (e.g. UBJ) used for rehydration.

recipe

A prepped recipes object used for preprocessing new data.

outcome

Outcome column name (default `"size"`).

feature_names

Optional vector of predictor names required at prediction time.

info

Optional list of metadata.

x

a `ldmppr_mark_model` object.

...

passed to methods.

object

a `ldmppr_mark_model` object.

new_data

a data frame of predictors (and possibly outcome columns).

path

path to an `.rds` created by [save_mark_model()] (or legacy objects).

Methods (by generic)

  • print(ldmppr_mark_model): Print a brief summary of the mark model.

  • predict(ldmppr_mark_model): Predict marks for new data.

  • save_mark_model(ldmppr_mark_model): Save method for `ldmppr_mark_model`.

Functions

  • ldmppr_mark_model(): Create a mark model container.

  • save_mark_model(): Save a mark model to disk.

  • load_mark_model(): Load a saved mark model from disk.

Details

These objects are typically returned by [train_mark_model()] and can be saved/loaded with [save_mark_model()] and [load_mark_model()].

The model may be backed by different engines (currently `"xgboost"` and `"ranger"`). For xgboost, the object can store a serialized booster payload to make saving/loading robust across R sessions.