Similar to other predict methods, this function predicts fitted values from a fitted "DiscriminantAnalysis" object.

# S3 method for DiscriminantAnalysis
predict(model, data, key, features = NULL, verbose = NULL)

Format

S3 methods

Arguments

model

R6Class object
A 'DiscriminantAnalysis' object for prediction.

data

DataFrame
DataFrame containting the data.

key

character
Name of the ID column.

features

character of list of characters, optional
Name of feature columns for prediction.
If not provided, it defaults to all non-key columns of data.

verbose

logical, optional
Whether or not outputs scores of all classes. If FALSE, only score of the predicted class will be outputed.
Defaults to FALSE.

Value

Predicted values are returned as a DataFrame, structured as follows.

  • ID column, with same name and type as data's ID column.

  • Label column, with same name and type as training data's labelcolumn.

  • SCORE column, score of each of the class.

Examples

Perform the prediction on a "DiscriminantAnalysis" object lda:


> result <- predict(lda,
                    data,
                    key = "ID")