Learn R Programming

smac (version 1.0)

predict.smac: A function that provides class label prediction and class conditional probability estimation for objects returned by the "smac" function.

Description

This function provides prediction on a test data set using the obtained classification model from a call of the smac function.

Usage

## S3 method for class 'smac':
predict(object,new.x=NULL,lambda=NULL,...)

Arguments

Value

new.xThe predictor matrix used for prediction.lambdaThe lambda values used for prediction.fitted.beta0The predicted intercept for each lambda value.fitted.betaA list of predicted matrices of parameters for each lambda value. The matrices in the list correspond to the lambda values in the returned lambda object in orders. Each row of a matrix corresponds to a predictor, and the name of the predictor is recorded as the row name. Note that a predictor does not affect the class label if and only if all elements in that corresponding row are 0.pred.yA list of predicted labels for each observation in new.x. A prediction is made for each lambda value in the returned lambda object.pred.probA list of data.frames containing predicted class conditional probabilities. Each data.frame object corresponds to a value in the lambda object. Each row of the data.frames corresponds to an observation in new.x, and each column represents a class, with the column name as the class label.

References

C. Zhang and Y. Liu (2014). Multicategory Angle-based Large-margin Classification. Biometrika, 101(3), 625-640.

See Also

smac

Examples

Run this code
data(ex1.data)
a=smac(ex1.data$ex1.x,ex1.data$ex1.y,loss="p",nlambda=30)
predict(a,ex1.data$ex1.new.x)

Run the code above in your browser using DataLab