Predict class labels of a validation set.
# S4 method for ExprsMachine
predict(object, array, verbose = TRUE)# S4 method for ExprsModule
predict(object, array, verbose = TRUE)
# S4 method for ExprsEnsemble
predict(object, array, how = "probability",
verbose = TRUE)
An ExprsModel object or an ExprsEnsemble object.
The classifier to deploy.
An ExprsArray object. The validation set.
A logical scalar. Toggles whether to print from
calcStats.
A character string. Select from "probability" or "majority".
See Details for the implication of this choice. Argument applies to
ExprsEnsemble prediction only.
Returns an ExprsPredict object.
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.