exprso (version 0.1.7)

exprso-predict: Predict Class Labels

Description

Predict class labels of a validation set.

Usage

"predict"(object, array, verbose = TRUE)
"predict"(object, array, verbose = TRUE)
"predict"(object, array, how = "probability", verbose = TRUE)

Arguments

object
An ExprsModel object or an ExprsEnsemble object. The classifier to deploy.
array
An ExprsArray object. The validation set.
verbose
A logical scalar. Toggles whether to print from calcStats.
how
A character string. Select from "probability" or "majority". See Details for the implication of this choice. Argument applies to ExprsEnsemble prediction only.

Value

Returns an ExprsPredict object.

Details

For an ExprsMachine:

An ExprsMachine object can only predict against an ExprsBinary object. An ExprsModule object can only predict against an ExprsMulti object. The validation set should never get modified once separated from the training set. If the training set used to build an ExprsModule had a class missing (i.e., has an NA placeholder), the ExprsModule cannot predict the missing class. To learn how this scenario gets handled, read more at doMulti.

ExprsPredict objects store predictions in three slots: @pred, @decision.values, and @probability. The first slot stores a "final decision" based on the class label with the maximum predicted probability. The second slot stores a transformation of the predicted probability for each class calculated by the inverse of Platt scaling. The predicted probability gets returned by the predict method called using the stored @mach object. To learn how these slots get used to calculate classifier performance, read more at calcStats.

For an ExprsEnsemble:

At the moment, ExprsEnsemble can only make predictions using ExprsMachine objects. Therefore, it can only predict against ExprsBinary objets. Predicting with ensembles poses a unique challenge with regard to how to translate multiple performance scores (one for each classifier in the ensemble) into a single performance score (for the ensemble as a whole). For now, the ExprsEnsemble predict method offers two options, toggled with the argument how. Regardless of the chosen how, buildEnsemble begins by deploying each constituent classifier on the validation set to yield a list of ExprsPredict objects.

When how = "probability", this method will take the average predicted class probability (i.e., @probability for each returned ExprsPredict object (corresponding to each constituent ExprsModel object). When how = "majority", this method will let the final decision from each returned ExprsPredict object (i.e., @pred) cast a single (all-or-nothing) vote. Each subject gets assigned the class that received the most number of votes (i.e., winner takes all). In both scenarios, ties get broken randomly with equal weights given to each class.

See Also

modHistory, calcStats