The SEMISUPLEARN Procedure
Example 21.1 German Credit Benchmark Data
This example applies the semisupervised learning algorithm to German credit benchmark data, which are available in the Sampsio.dmagecr data set. This data set contains 1,000 observations, each of which contains an applicant’s information, including the applicant’s credit rating (good or bad). The binary target is named GOOD_BAD. The other input variables are Duration, Amount, InstallP, Resident, and Existcr.
The following statements load the unlabeled data table with 800 observations and the labeled data table with 50 observations:
data mycas.dmagecrunlabel(drop=good_bad);
set sampsio.dmagecr(obs=800);
id=_N_;
run;
data mycas.dmagecrlabel;
set sampsio.dmagecr(obs=50);
run;
The following statements run the SEMISUPLEARN procedure on the unlabeled data table mycas.dmagecrUnlabel and the labeled data table mycas.dmagecrLabel:
proc semisuplearn data=mycas.dmagecrunlabel label=mycas.dmagecrlabel;
input duration amount installp resident existcr;
kernel KNN/k=5;
output out = mycas.out copyvars=(amount installp id);
target good_bad;
run;
Output 21.1.1 shows the number of unlabeled observations, number of labeled observations, number of levels for the target variable, gamma value, maximum number of iterations, kernel used in the computation, number of nearest neighbors and the loss.
Output 21.1.1: Model Information
| Model Information | |
|---|---|
| Labeled Observations Used | 50 |
| Unlabeled Observations Used | 800 |
| Maximum Iterations | 3 |
| Target Number of Levels | 2 |
| Gamma | 20 |
| Nearest Neighbors | 5 |
| Kernel Function | KNN |
| Loss |
|---|
| 23.189249 |
| Output CAS Tables | |||
|---|---|---|---|
| CAS Library | Name | Number of Rows | Number of Columns |
| CASUSERHDFS(tiarno) | OUT | 850 | 5 |
The following statements sort the output of PROC SEMISUPLEARN by id and show the observations from 110 to 118:
data out2; set mycas.out; run;
proc sort data=out2; by id; run;
proc print data=out2(firstobs=110 obs=118);
run;
Output 21.1.2 shows the values of the amount, installp, and id variables; the predicted labels for the nine observations; and the indicators for the labeled or unlabeled data.
Output 21.1.2: CAS Output
| Obs | amount | installp | id | I_good_bad | _WARN_ |
|---|---|---|---|---|---|
| 110 | 6229 | 4 | 60 | bad | 0 |
| 111 | 1391 | 2 | 61 | bad | 0 |
| 112 | 1537 | 4 | 62 | good | 0 |
| 113 | 1953 | 4 | 63 | good | 0 |
| 114 | 14421 | 2 | 64 | bad | 0 |
| 115 | 3181 | 4 | 65 | good | 0 |
| 116 | 5190 | 4 | 66 | good | 0 |
| 117 | 2171 | 2 | 67 | good | 0 |
| 118 | 1007 | 4 | 68 | good | 0 |