The HPSVM Procedure
Getting Started: HPSVM Procedure
This example trains the model by using a data set named SAMPSIO.DMAGECR (a German credit benchmark data set). This data set is saved in the SAS library SAMPSIO, and it contains 1,000 observations. Each observation consists of an applicant’s information, including the applicant’s credit rating (GOOD or BAD). The binary target is named GOOD_BAD. Other variables are Checking, Duration, History, and so on. For more information about the data, see http://support.sas.com or http://support.sas.com/documentation/cdl/en/emgs/59885/HTML/default/a001026918.htm.
The following statements produce the results shown in Figure 1 through Figure 4:
proc hpsvm data=sampsio.dmagecr;
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;
run;
The "Performance Information" table in Figure 1 shows that the procedure is executed in single-machine mode and the number of threads is 4.
Figure 1: German Credit Performance Information
| Performance Information | |
|---|---|
| Execution Mode | Single-Machine |
| Number of Threads | 4 |
The "Training Results" table in Figure 2 shows that the inner product of weights is 11.6121718, the bias is –2.1296773, and the number of support vectors is 531, where 481 of those vectors are on the margin. The table also shows that the maximum decision function value (Maximum F) is 2.57131793 and the minimum decision function value (Minimum F) is –4.6513481.
Figure 2: German Credit Training Results
| Training Results | |
|---|---|
| Inner Product of Weights | 11.6121718 |
| Bias | -2.1296773 |
| Total Slack (Constraint Violations) | 492.87883 |
| Norm of Longest Vector | 4.17809329 |
| Number of Support Vectors | 531 |
| Number of Support Vectors on Margin | 481 |
| Maximum F | 2.57131793 |
| Minimum F | -4.6513481 |
| Number of Effects | 20 |
| Columns in Data Matrix | 61 |
The "Classification Matrix" table in Figure 3 shows that among the total of 1,000 observations, 700 observations are good and 300 observations are bad. The number of correctly predicted good observations is 626, and the number of correctly predicted bad observations is 158. Thus the accuracy is 78.4%, as indicated in the "Fit Statistics" table shown in Figure 4.
Figure 3: German Credit Classification Matrix
| Classification Matrix | |||
|---|---|---|---|
| Observed | Training Prediction | ||
| good | bad | Total | |
| good | 626 | 74 | 700 |
| bad | 142 | 158 | 300 |
| Total | 768 | 232 | 1000 |
Figure 4: German Credit Accuracy
| Fit Statistics | |
|---|---|
| Statistic | Training |
| Accuracy | 0.7840 |
| Error | 0.2160 |
| Sensitivity | 0.8943 |
| Specificity | 0.5267 |
A relatively good model means that misclassification is low but both sensitivity and specificity are high. With PROC HPSVM, you can always adjust training parameters and use different kernels to obtain a better model.