SVMACHINE Procedure
Example 39.8 Tuning the Hyperparameters of a Support Vector Machine
This example illustrates how you can use the AUTOTUNE statement in the SVMACHINE procedure to tune the hyperparameters of a support vector machine (SVM) model. It uses the home equity data set Hmeq, which is in the Sampsio library.
The Hmeq data set contains 5,960 observations with 13 variables. The response variable, Bad, is a binary indicator to predict which clients will default on their loan.
The following statements load the data table Hmeq into your CAS session. For this example, the statements assume that your CAS engine libref is named mylib, but you can substitute any appropriately defined CAS engine libref.
data mylib.hmeq;
set sampsio.hmeq;
run;
The following statements use PROC SVMACHINE with the AUTOTUNE statement to automatically tune the hyperparameters of an SVM model:
proc svmachine data=mylib.hmeq;
input clage clno debtinc loan mortdue value yoj delinq derog job ninq;
input delinq derog job ninq / level=nominal;
target bad;
autotune
/* Tuning Parameters
You do not need to specify any tuning parameters for the default
tuning process. If you want to make adjustments to the default
tuning process, uncomment the following block of code and change
any of the tuning parameters' attributes.
tuningParameters=(
C ( lb=1e-10 ub=100 init=1.0 )
DEGREE ( lb=2 ub=3 init=2 )
KERNEL_METHOD ( values=LINEAR_IPOINT POLYNOMIAL_IPOINT
LINEAR_CD LINEAR_ACTIVESET POLYNOMIAL_ACTIVESET
RBF_ACTIVESET SIGMOID_ACTIVESET init=LINEAR_IPOINT )
RBFPARAMETER ( lb=0.1 ub=100 init=0.1 )
SIGMOIDPARAMETER1 ( lb=0.1 ub=10.0 init=0.1 )
SIGMOIDPARAMETER2 ( lb=-10 ub=-0.1 init=-0.1 )
REGL2 ( lb=0.1 ub=100 init=0.1 )
)
*/
;
/* Remove this line to see all results */
ods select BestConfiguration EvaluationHistoryPlot IterationHistoryPlot;
run;
The preceding statements produce the table and the plots shown in Output 39.8.1 through Output 39.8.3. The table in Output 39.8.1 displays the evaluation number, the values of the tuning parameters, and the error metric value for the best SVM model that the tuner found. Note that the ODS SELECT statement limits the displayed results to a single table and two plots. You can remove this statement to display all tables and plots. For the full list of ODS tables that PROC SVMACHINE produces, see Table 3.
Output 39.8.1: Best Configuration Table
| Best Configuration | |
|---|---|
| Evaluation | 56 |
| Kernel/Method | SIGMOID_ACTIVESET |
| Penalty (C) | 63.8888889 |
| Sigmoid Parameter 1 | 1.2 |
| Sigmoid Parameter 2 | -5.6 |
| Misclassification Error Percentage | 17.73 |
Output 39.8.2 displays a scatter plot of all configurations that the tuner tried. The objective values are shown on the Y axis, and the evaluation numbers are shown on the X axis.
Output 39.8.2: Evaluation History Plot

The plot in Output 39.8.3 displays how the best found objective value and the elapsed time changed with each iteration of the tuner.
Output 39.8.3: Iteration History Plot
