RECENGINE Procedure
Example 28.3 Tuning Hyperparameters of an MF-PDF Model
This example shows how to use the AUTOTUNE statement in the RECENGINE procedure to tune a matrix factorization with partially defined factors (MF-PDF) model on the usersCommunity data set (which is available here:
https://support.sas.com/documentation/onlinedoc/viya/examples.htm
). The data set consists of click events over a period of time on a peer-to-peer-support community website. Each web page (viewed as an item by PROC RECENGINE) on the site belongs to a message board that includes a number of topics of specific interest. The same user might have viewed the same web page multiple times. Also, in this data set, it is indicated whether or not the questions within the topic have been resolved. For each click event, the user ID and item ID are recorded. The data set includes 40,000 click events (user feedback).
The following code includes the DATA step that generates the data table usersCommunity. These statements assume that your libref is named mylib, but you can substitute any appropriately named libref.
data mylib.usersCommunity;
input itemid boardid userid isSolvedTopic;
datalines;
38 4817 6313 0
15 7589 1355 1
46 9560 2926 1
16 11635 3985 1
38 13023 4163 0
... more lines ...
The following statements use PROC RECENGINE with the AUTOTUNE statement to tune an MF-PDF model on the usersCommunity data:
proc recengine
data=mylib.userscommunity
method=dtos
outmodel=mylib.dtosmodel;
input userid itemid / level=nominal;
input issolvedtopic / level=interval;
userid userid;
itemid itemid;
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=(
MAXITER ( init=10 lb=1 ub=1000 )
MINNORMOBJCHANGE ( init=0.01 lb=1E-10 ub=1.0 )
NFACTORS ( init=1 lb=1 ub=50 )
REGL2 ( init=0.01 lb=0.001 ub=1000 )
FEEDBACKCONFIDENCESLOPE ( init=50 lb=1E-10 ub=100 )
NOUSERBIAS
NOITEMBIAS
)
*/
;
ods select BestConfiguration; /* Remove to see all results tables */
run;
These statements produce the table shown in Output 28.3.1. The table displays the evaluation number, the values of the tuning parameters, and the error metric value for the best MF-PDF 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 RECENGINE produces, see Table 3.
Output 28.3.1: Best Configuration Table
| Best Configuration | |
|---|---|
| Evaluation | 50 |
| Maximum Number of Iterations | 1000 |
| Minimum Normalized Objective Change | 0 |
| Number of Factors | 26 |
| L2 Regularization | 500.0005 |
| Confidence Slope | 100 |
| Has User Bias | TRUE |
| Has User Bias | TRUE |
| Mean Average Precision | 0.9237302087 |