This function predicts class labels of labeled dataset from a fitted "GLM" object, and return the corresponding R2 score.

# S3 method for GLM
score(
  model,
  data,
  key,
  features = NULL,
  label = NULL,
  handle.missing = NULL,
  ...
)

Format

S3 methods

Arguments

model

R6Class object
A "GLM" object for scoring.

key

character
Specifies the ID column in data.

features

character or list of characters, optional
Specifies the feature columns in data.
The specified features must be the same as those in the model training phase.
Defaults to all non-key, non-label columns in data if not provided.

label

character, optional
Specifies the label column in data.
If not provided, defaults to the last non-key column in data.

handle.missing

c("remove", "fill_zero"), optional
Specifies how to handle data rows with missing values in feature columns.

  • "remove" Remove rows with missing values.

  • "fill_zero" Replace missing values with 0.

Defaults to "remove".

...

Reserved parameters.

Value

numeric
The R2 score of model applied to data.