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

View source: R/predict.R

predict.svmmajR Documentation

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 class 'svmmaj'
predict(object, X.new, y = NULL, weights = NULL, show.plot = FALSE, ...)

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.

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.

Author(s)

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


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

SVMMaj documentation built on Sept. 11, 2024, 6:06 p.m.