Learn R Programming

SVMMaj (version 0.2.9.3)

predict.svmmaj: Out-of-Sample Prediction from Unseen Data.

Description

This function predicts the predicted value (including intercept), given a previous trained model which has been returned by svmmaj.

Usage

# S3 method for svmmaj
predict(object, X.new, y = NULL, weights = NULL, show.plot = FALSE, ...)

Value

The predicted value (including intercept) of class q.svmmaj, with attributes:

y

The observed class labels of each object.

yhat

he predicted class labels of each object.

classes

The class labels.

Arguments

object

Model which has been trained beforehand using svmmaj.

X.new

Attribute matrix of the objects to be predicted, which has the same number of attributes as the untransformed attribute matrix in model.

y

The actual class labels (only if show.plot==TRUE).

weights

The weight of observation as the relative importance of the prediction error of the observation.

show.plot

If show.plot=TRUE, it plots the density of the predicted value for both class labels, if y is not specified, the density of all objects will be plotted.

...

Arguments to be passed to methods.

Author

Hok San Yip, Patrick J.F. Groenen, Georgi Nalbantov

References

P.J.F. Groenen, G. Nalbantov and J.C. Bioch (2008) SVM-Maj: a majorization approach to linear support vector machines with different hinge errors.

See Also

svmmaj

Examples

Run this code

attach(AusCredit)

## model training
model <- svmmaj(X[1:400, ], y[1:400], hinge = "quadratic", lambda = 1)
## model prediction
q4 <- predict(model, X[-(1:400), ], y[-(1:400)], show.plot = TRUE)
q4

Run the code above in your browser using DataLab