SVDD Procedure
Example 38.6 Using the ORDER Option
Different processing modes, such as symmetric multiprocessing mode (SMP) or massively parallel processing mode (MPP) with different numbers of worker nodes, can lead to minor changes in the SVDD training results. For more information about how processing mode can affect training results, see the section Processing Mode and SVDD Results. You can reduce the impact of processing modes by using the ORDER option. This example shows how to use the ORDER option.
The following DATA step creates the boomerang data (which is stored in the Work library by default):
data boomerang;
infile datalines delimiter=',';
input x y ;
datalines;
0.42811,0.37735
0.54919,9.6279
0.95062,9.5149
1.46928,9.2645
... more lines ...
The following DATA step creates a new variable, _SVDD_ROWID_, in the Work.boomerang data set. The _SVDD_ROWID_ variable is used internally by PROC SVDD to sort the input training data set Work.boomerang. For more information about why sorting is needed, see the description of the ORDER option. The variable class is created to indicate training observations.
data Work.boomerang;
length class $6;
set Work.boomerang;
_SVDD_ROWID_=_n_;
class="Train";
run;
The following DATA step creates the scoring data set Work.scoreds. Note that this data set does not include the _SVDD_ROWID_ or _ROWID_ variable. The variable class is created to indicate scoring observations.
data Work.scoreds;
length class $6;
class="Score";
x=5;
y=5;
output;
run;
The following statements create the Work.boomerang_combined data set by concatenating the Work.boomerang and Work.scoreds data sets:
data Work.boomerang_combined ;
set Work.boomerang Work.scoreds;
run;
The following statements plot variable x against variable y:
proc sgplot data=Work.boomerang_combined;
styleattrs datacontrastcolors=(blue) datasymbols=(circle circlefilled ) ;
title "Boomerang-Shaped Data";
scatter x=x y=y/group=class;
run;
Output 38.6.1 shows the results. The unfilled blue markers indicate the training data, and the filled blue marker indicates the scoring observation. The training data, as the name of the data set indicates, are in the shape of a boomerang. The single scoring observation is clearly an outlier.
Output 38.6.1: Boomerang-Shaped Training Data

You can load the Work.boomerang data set into your CAS session by specifying your CAS engine libref in the first statement in the following DATA step:
data mylib.boomerang;
set Work.boomerang;
run;
These statements assume that your CAS engine libref is named mylib, as in the section Using CAS Sessions and CAS Engine Librefs, but you can substitute any appropriately defined CAS engine libref.
The following statements execute the SVDD algorithm on the mylib.boomerang data table and produce the results shown in Output 38.6.2 through Output 38.6.5. The PROC SVDD statement uses the ORDER option.
proc svdd data=mylib.boomerang order outsv=mylib.sv ;
id x y;
input x y/level=interval;
kernel rbf / bw=mean;
solver actset;
savestate rstore=mylib.state;
run;
The INPUT statement defines the input variables x and y as interval variables. The KERNEL statement specifies the kernel function as a radial basis function (RBF) and specifies MEAN as the bandwidth calculation method. The SAVESTATE statement creates an analytic store for the model and saves it as a binary object in the mylib.state data table. You can use the analytic store later in the ASTORE procedure for scoring. The "Model Information" table in Output 38.6.2 summarizes the key options and the input data variables.
Output 38.6.2: Boomerang Data Model Information
| Model Information | |
|---|---|
| Optimization Method | Active Set |
| Kernel Type | RBF |
| RBF Kernel Bandwidth | 0.7263714897 |
| Bandwidth Selection Method | Mean (delta = 1e-06) |
| Bandwidth Relative Scale | 1 |
| Expected Outlier Fraction | 1E-6 |
| Optimization Tolerance | 0.0001 |
| Number of Interval Variables | 2 |
| Number of Nominal Variables | 0 |
The "Training Results" table in Output 38.6.3 shows the number of support vectors and the threshold value.
Output 38.6.3: Boomerang Data Training Results
| Training Results | |
|---|---|
| Number of Support Vectors | 44 |
| Number of Support Vectors on Boundary | 44 |
| Number of Dropped Observations | 0 |
| Threshold R Square Value | 0.92854 |
| Constant (C_r) Value | 0.07152 |
| Run Time (seconds) | 0.00244 |
| Bandwidth Calculation Time (seconds) | 0.00000215 |
Output 38.6.4 displays the number of observations in the training data set.
Output 38.6.4: Boomerang Data Training Observations
| Number of Observations Read | 267 |
|---|---|
| Number of Observations Used | 267 |
The "Optimization Summary" table in Output 38.6.5 shows whether the solution is optimal, the number of iterations that were required, and the objective function value.
Output 38.6.5: Boomerang Data Optimization Summary
| Optimization Summary | |
|---|---|
| Number of Iterations | 1 |
| Objective Value | 0.0715177856 |
| Infeasibility | 0.0000506817 |
| Optimization Status | Optimal |
| Degenerate | No |
The following DATA step loads the Work.scoreds scoring data into the CAS session:
data mylib.scoreds;
set Work.scoreds;
run;
The following code scores the mylib.scoreds data by using the mylib.state analytic store that was created during training:
proc astore;
score data=mylib.scoreds
out=mylib.score_results
rstore=mylib.state;
quit;
The PROC PRINT code prints the mylib.score_results data table and produces the results in Output 38.6.6:
proc print data=mylib.score_results label;
run;
Output 38.6.6: Scoring Results
| Boomerang-Shaped Data |
| Obs | x | y | SVDD Distance | SVDD Score |
|---|---|---|---|---|
| 1 | 5 | 5 | 1.07125 | 1 |
The SVDD score of 1 indicates that the scoring observation is correctly classified as an outlier.