GPREG Procedure
Example 16.2 Tuning Hyperparameters of a Gaussian Process Regression Model
This example uses the Class data table to demonstrate how to use the AUTOTUNE statement in the GPREG procedure to automatically tune the hyperparameters of a Gaussian process regression model. The Class data table, which is generated by the following SAS code, contains weight and height data that were collected from a class of 19 students. PROC GPREG predicts the weight of each student in the class on the basis of the student’s height.
data mylib.class;
set sashelp.class;
run;
These statements assume that your libref is named mylib, but you can substitute any appropriately defined libref.
The following statements use PROC GPREG with the AUTOTUNE statement to automatically tune the hyperparameters of a Gaussian process regression model:
proc gpreg
data=mylib.class
seed=12345
nThreads=32
nInducingPoints=3
fixInducingPoints
outInducingPoints=mylib.gpreg_ip
outVariationalCov=mylib.gpreg_cov;
target Weight / level=interval;
input Height;
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=(
ALGORITHM ( values=SGD ADAM init=SGD )
ARD ( values=FALSE TRUE init=FALSE )
JITTERMAXITERS ( lb=5 ub=15 init=10 )
KERNEL ( values=LINEAR MATERN32 MATERN52 PERIODIC RBF init=RBF )
LEARNINGRATE ( lb=1E-7 ub=2.0 init=1E-3 )
MINIBATCHSIZE ( values=1 2 4 8 16 32 64 init=1 exclude )
MOMENTUM ( lb=0.0 ub=0.99 init=0.1 )
NINDUCINGPOINTS ( lb=25 ub=150 init=100 )
TUNEADAPTIVEDECAY ( lb=0.0 ub=0.99 init=0.95 )
TUNEADAPTIVERATE ( values=FALSE TRUE init=FALSE exclude )
)
*/
;
ods select BestConfiguration; /* Remove to see all results tables */
run;
These statements produce the table shown in Output 16.2.1. The table displays the evaluation number, the values of the tuning parameters, and the error metric value for the best Gaussian process regression model that the tuner found. Note that the ODS SELECT statement limits the displayed results to a single table. You can remove this statement to see all results tables. For the full list of ODS tables that PROC GPREG produces, see Table 3.
Output 16.2.1: Best Configuration Table
| Best Configuration | |
|---|---|
| Evaluation | 88 |
| Automatic Relevance Determination | TRUE |
| Kernel | LINEAR |
| Maximum Number of Iterations for Jitter Cholesky Decomposition | 7 |
| Number of Inducing Points | 93 |
| Algorithm | ADAM |
| Momentum | 0.87117201 |
| Learning Rate | 0.07608437 |
| Adaptive Decay | 0.45358469 |
| Root Average Square Error | 21.62438784 |