Skip to contents

This function is a patroklos-compliant fitter with validated predictions, it has a return value with a val_predict attribute.

Usage

ptk_ranger(x, y, rel_mtry, mtry = NULL, skip_on_invalid_input = FALSE, ...)

Arguments

x

Named numeric matrix. Predictor matrix without NAs. Samples correspond to rows. Discrete features are encoded as binary dummy variables.

y

Named list with the response in thee formats:

  • "bin", a named numeric one-column matrix, binary response,

  • "cox", a named numeric two-column matrix, with columns "time_to_event" and "event" (0 = censoring, 1 = event), the response in the Cox format,

  • "true", a named numeric one-column matrix, true binary response.

The rownames of y[["bin"]] and y[["true"]] are a subset of the rownames of x and, in general, do not coincide. Use intersect_by_names() to get equal rownames.

rel_mtry

logical. If TRUE, interpret mtry as relative to sqrt(ncol(x)) (the recommended value), rounded to the next integer. Otherwise, take mtry directly.

mtry

integer. Number of features to consider at each split when growing a tree of the random forest.

skip_on_invalid_input

Logical. If TRUE and invalid input is detected, return NA instead of an error. This is useful when calling this function from inside long_nestor().

...

Further arguments passed to the wrapped function.

Value

A ptk_ranger S3 object, a ranger S3 object with the (OOB) predictions attribute renamed to val_predict.