SVMACHINE Procedure
Example 39.4 Coordinate Descent Method
In this example, you can apply the same German credit benchmark data that are specified in the section Getting Started: SVMACHINE Procedure. Instead of using the default interior point method, you can apply the coordinate descent method and save the model to an analytic store. After that, you can load the testing data set sampsio.dmagescr into your CAS session and apply the model to the testing data by using the ASTORE procedure.
You can load the sampsio.dmagecr data set into your CAS session as described in the section Getting Started: SVMACHINE Procedure.
The following statements execute the SVM coordinate descent algorithm on the mylib.dmagecr data table and save the training model as mylib.dmageModel. The generated results are listed in Output 39.4.1 through Output 39.4.3.
proc svmachine data=mylib.dmagecr
method=CD regL1=1.0;
input checking history purpose savings employed marital coapp
property other job housing telephon foreign/level=nominal;
input duration amount installp resident existcr depends age/level=interval;
target good_bad;
savestate rstore=mylib.dmageModel;
run;
The procedure option METHOD=CD defines the training algorithm as coordinate descent. The option REGL1=1.0 specifies that the L1 penalty value is used. The SAVESTATE statement shows that the trained model is saved as mylib.dmageModel.
The "Model Information" table is displayed in Output 39.4.1. From this table, you can see that the optimization technique is coordinate descent and the penalty method is "regL1," as well as other parameter settings.
Output 39.4.1: German Credit Model Information
| Model Information | |
|---|---|
| Task Type | C_CLAS |
| Optimization Technique | Coordinate Descent |
| Scale | YES |
| Kernel Function | Linear |
| Penalty Method | regL1 |
| Penalty Parameter | 1 |
| Maximum Iterations | 100 |
| Tolerance | 1e-06 |
| Seed | 1 |
The "Misclassification Matrix" table in Output 39.4.2 shows that among the total of 1,000 observations, 700 observations are classified as good and 300 observations are classified as bad. The number of correctly predicted good observations is 603, and the number of correctly predicted bad observations is 180. Thus the accuracy is 78.30%, as indicated in the "Fit Statistics" table in Output 39.4.3.
Output 39.4.2: German Credit Misclassification Matrix
| Misclassification Matrix | |||
|---|---|---|---|
| Observed | Training Prediction | ||
| good | bad | Total | |
| good | 603 | 97 | 700 |
| bad | 120 | 180 | 300 |
| Total | 723 | 277 | 1000 |
Output 39.4.3: German Credit Accuracy
| Fit Statistics | |
|---|---|
| Statistic | Training |
| Accuracy | 0.7830 |
| Error | 0.2170 |
| Sensitivity | 0.8614 |
| Specificity | 0.6000 |
Now you can load the data set sampsio.dmagescr into the CAS session and apply the model mylib.dmageModel by using the ASTORE procedure to generate the score results:
data mylib.dmagescr;
set sampsio.dmagescr;
run;
proc astore;
score data=mylib.dmagescr out=mylib.dmagescore
rstore=mylib.dmageModel copyvar=(CUSTID);
run;
quit;
proc print data=mylib.dmagescore(obs=10);
run;
Output 39.4.4 displays 10 observations from the data table mylib.dmagescore.
Output 39.4.4: German Credit Score Results
| Obs | _P_ | P_good_badgood | P_good_badbad | I_good_bad | _WARN_ | CUSTID |
|---|---|---|---|---|---|---|
| 1 | 0.27941 | 0.43925 | 0.56075 | bad | 649 | |
| 2 | -1.71000 | 0.70980 | 0.29020 | good | 858 | |
| 3 | -2.05762 | 0.75245 | 0.24755 | good | 212 | |
| 4 | -2.37612 | 0.79153 | 0.20847 | good | 166 | |
| 5 | -1.03343 | 0.62679 | 0.37321 | good | 563 | |
| 6 | -1.73022 | 0.71228 | 0.28772 | good | 454 | |
| 7 | -0.15340 | 0.51882 | 0.48118 | good | 938 | |
| 8 | -0.89911 | 0.61031 | 0.38969 | good | 120 | |
| 9 | 1.32133 | 0.21272 | 0.78728 | bad | 375 | |
| 10 | -0.35075 | 0.54303 | 0.45697 | good | 970 |