SVMACHINE Procedure
Example 39.6 Reduced SVM Method
In this example, you can apply the SVMACHINE procedure to the same home equity loan data as in Home Equity Loan Case. But instead of using the default interior point method, you can apply the reduced support vector machine (RSVM) method and save the model to an analytic store.
The following statements run the RSVM algorithm on the mylib.hmeq data table and save the training model to the analytic store mylib.rsvmModel. The results are shown in Output 39.6.1 through Output 39.6.3.
proc svmachine data=mylib.hmeq method=RSVM noscale
sampleType=STRATIFY sampleRate=0.4 seed=1234;
input reason job derog delinq ninq / level=nominal;
input loan mortdue value yoj clage clno debtinc / level=interval;
target bad;
kernel RBF / k_par=1.0;
savestate rstore=mylib.rsvmModel;
run;
The METHOD=RSVM option defines the training algorithm as reduced SVM. The SAMPLETYPE= option value is STRATIFY, which applies stratified sampling to the target variable bad. The sampling rate is 0.4, which is 40% of valid observations of the training data. The SAVESTATE statement saves the trained model to the analytic store mylib.rsvmModel.
The "Model Information" table is displayed in Output 39.6.1. From this table, you can see that the optimization technique is reduced SVM, the kernel function is RBF, and the kernel parameter value is 1.
Output 39.6.1: HMEQ Model Information
| Model Information | |
|---|---|
| Task Type | C_CLAS |
| Optimization Technique | Reduced SVM |
| Scale | NO |
| Kernel Function | RBF |
| RBF Parameter | 1 |
| Penalty Method | C |
| Penalty Parameter | 1 |
| Tolerance | 0.0001 |
| Seed | 1234 |
| Sample Type | STRATIFY |
| Sample Rate | 0.4 |
The "Misclassification Matrix" table in Output 39.6.2 shows that among the total of 3,364 training observations, 300 observations are in class 1 and 3,064 observations are in class 0. The number of correctly predicted observations in class 1 is 120, and the number of correctly predicted observations in class 0 is 3,064. Thus the accuracy is 94.65%, as indicated in the "Fit Statistics" table in Output 39.6.3.
Output 39.6.2: HMEQ Misclassification Matrix
| Misclassification Matrix | |||
|---|---|---|---|
| Observed | Training Prediction | ||
| 1 | 0 | Total | |
| 1 | 120 | 180 | 300 |
| 0 | 0 | 3064 | 3064 |
| Total | 120 | 3244 | 3364 |
Output 39.6.3: HMEQ Accuracy
| Fit Statistics | |
|---|---|
| Statistic | Training |
| Accuracy | 0.9465 |
| Error | 0.0535 |
| Sensitivity | 0.4000 |
| Specificity | 1.0000 |
Now you can load the data set into your CAS session, and you can apply the model mylib.rsvmModel to generate the score results by using the ASTORE procedure as specified in Coordinate Descent Method.
Note: Input data must be in a CAS table that is accessible in your CAS session. You must refer to this table by using a two-level name. The first level must be a CAS engine libref, and the second level must be the table name. For more information, see the sections Using CAS Sessions and CAS Engine Librefs and Loading a SAS Data Set onto a CAS Server in Chapter 2, Shared Concepts.