Skip to contents

This function is the prototype of a fitter with the minimal requirements in its parameters and return value to work as the fitter attribute of a Model object.

Usage

fitter_prototype(x, y, val_error_fun, ...)

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.

val_error_fun

Function to calculate the error of validated predictions. For its interface, see val_error_fun_prototype()

...

Further, fitter-specific hyperparameters.

Value

An S3 object with underlying class list, which we call fit_obj. The named list must have the following element:

  • "val_predict": a numeric one-column matrix with row names, the validated predictions of the (picked) fitted model. The row names are a subset of the row names of x. The fitter may tune hyperparameters and therefore fit multiple models. The val_predict attribute must contain of the best validated model among them.

There must be a predict() method for the fit_obj. See predict_method_prototype() for its interface.