1. Home
  2. SVMPREDICT procedure

SVMPREDICT procedure

Forms the predictions using a support vector machine (D. B. Baird).

Options

SCALE = texts or pointers Gives scaling used for the X variates
SAVEFILE = texts Gives support vector machine model file; default is to use the model from the last support vector machine

Parameters

X = pointers Each pointer contains a set of variates defining the attributes for the predictions
PREDICTIONS = factors or variates Saves the classification groupings or predicted values for each observation in X
GROUPDEFINITIONS = factors Supplies levels and labels for predicted groups; default uses ordinal levels

Description

SVMPREDICT forms predictions using a support vector machine (Cortes & Vapnik 1995) fitted by SVMFIT. The input for the procedure is given by a pointer specified by the X parameter. The X pointer contains a set of variates and factors defining the attributes of the units. Any unit with a missing value in any of the variates is taken as having a central value for that attribute.

The PREDICTIONS parameter returns the predictions in a factor for a classification support vector machine, or a variate for a regression support vector machine. The GROUPDEFINITIONS parameter can be used to specify the levels and labels for factor predictions. If GROUPDEFINITIONS is unset, the ordinal levels 1…n are used.

The SAVEFILE option specifies the model file for a support vector machine saved by SVMFIT. If this is not specified, the last fitted model created by SVMFIT will be used.

The SCALE option gives the scaling used for the attributes. This can either be in a file saved by SVMFIT, or in a pointer containing two variates with the same length as the X pointer. The variates give the slope and the constant, respectively, used to scale each X variate. The scaled variates are then

slope × X[] + constant

If SCALE is not specified, the X variates will not be scaled. Note, though, that the attributes in X must be on the same scale as that used in SVMFIT for the predictions to be correct.

Options: SCALE, SAVEFILE.

Parameters: X, PREDICTIONS, GROUPDEFINITIONS.

Method

The C++ libraries LIBSVM (Chang and Lin, 2001) and LIBLINEAR (Fan et al., 2008) have been compiled into the library GenSVM.DLL, and this is called from SVMPREDICT. A user guide by Hsu et al. (2003) gives details on using this software.

Action with RESTRICT

The input variates and factor may be restricted. The restrictions must be identical.

References

Cortes, C. & Vapnik, V. (1995). Support-vector networks. Machine Learning, 20, 273-297.

URL: http://link.springer.com/article/10.1007%2FBF00994018

Chang, C.C. & Lin, C.J. (2001). LIBSVM: A library for support vector machines.

URL: http://www.csie.ntu.edu..tw/~cjlin/libsvm

Fan, R.E., Chang, K.W., Hsieh, X.R., Wang X.R., & Lin C.J. (2008). LIBLINEAR: A library for large linear classification. Journal of Machine Learning Research, 9, 1871-1874.

URL: http://www.csie.ntu.edu.tw/~cjlin/papers/liblinear.pdf

Hsu, C.W., Chang, C.C., & Lin, C.J. (2003). A practical guide to support vector classification. (Technical report). Department of Computer Science and Information Engineering, National Taiwan University.

URL: http://www.csie.ntu.edu.tw/~cjlin/papers/guide/guide.pdf

See also

Directive: CVA.

Procedures: SVMFIT, DISCRIMINATE, QDISCRIMINATE, SDISCRIMINATE.

Example

CAPTION    'SVMPREDICT for classification: Fisher Iris data'; STYLE=meta
SPLOAD     [PRINT=*] '%DATA%/Iris.gsh'
POINTER    [VALUES=Sepal_Length,Sepal_Width,Petal_Length,Petal_Width] Var
"Model saved permanently"
SVMFIT     [PRINT=summary,allocations; SEED=726454] Y=Species; X=Var;\
           SCALE=IScale
SVMPREDICT [SCALE=IScale] X=Var; PREDICTIONS=PSpecies; GROUPDEF=Species
TABULATE   [PRINT=counts; CLASS=Species,PSpecies; MARGIN=yes]

CAPTION    'SVMPREDICT for regression: Los Angeles Ozone data'; STYLE=meta
SPLOAD     [PRINT=*] '%DATA%/Ozone.gsh'; ISAVE=Data
SUBSET     [Ozone /= !s(*)] Data[] 
POINTER    [VALUES=Data[1,2,(5...10)]] OZVars
SVMFIT     [PRINT=summary; SVMTYPE=svr; PENALTY=100; GAMMA=0.1; SEED=562011]\
           Y=Ozone; X=OZVars; SCALE=OScale
SVMPREDICT [SCALE=OScale] X=OZVars; PREDICTIONS=POzone
DGRAPH     [TITLE='Los Angeles Ozone levels 1976 ~{epsilon} SVM-regression';\
           WINDOW=3; KEY=0] Y=POzone; X=Ozone
Updated on March 5, 2019

Was this article helpful?