decisionTree

gbtreeCode

Description

Generates DATA step scoring code from a gradient boosting tree model.

Settings
ParameterDescription
codeRequests that the action produce SAS score code. Specify additional parameters such as 'casOut' to save the code to a table.
encodeNameSpecifies whether to encode the variable names such as predicted probabilities of a binary or nominal target in the generated casout table. The predicted probabilities are named with the prefix P_ instead of _DT_P_.
modelTableSpecifies the table containing the model to be used for generating the score code.
Data Preparation View data prep sheet
Load Data for Modeling

Loads the HMEQ dataset into the active CAS session to be used for training a gradient boosting model.

Copied!
1PROC CAS;
2 SESSION casauto;
3 TABLE.loadTable / caslib="samples" path="hmeq.csv" casout="hmeq";
4RUN;

Examples

Trains a gradient boosting tree model on the HMEQ data and then generates the SAS DATA step score code to the log.

SAS® / CAS Code Code awaiting community validation
Copied!
1PROC CAS;
2 decisionTree.gbtreeTrain /
3 TABLE="hmeq"
4 target="BAD"
5 inputs={"LOAN", "MORTDUE", "VALUE", "REASON", "JOB", "YOJ", "DEROG", "DELINQ", "CLAGE", "NINQ", "CLNO", "DEBTINC"}
6 model={name="gb_model"};
7 decisionTree.gbtreeCode /
8 modelTable="gb_model";
9RUN;
Result :
The SAS score code is printed to the result log.

Generates the SAS score code from the trained model and saves it directly to a CAS table named 'score_code' using the 'code' parameter options.

SAS® / CAS Code Code awaiting community validation
Copied!
1PROC CAS;
2 decisionTree.gbtreeCode /
3 modelTable="gb_model"
4 code={casOut={name="score_code", replace=true}};
5RUN;
Result :
The table 'score_code' is created in the active caslib containing the generated SAS code.

FAQ

What is the primary function of the gbtreeCode action?
Which parameter must be specified to identify the model?
How does the encodeName parameter affect the output variables?
What is the effect of setting the singlePass parameter to TRUE?
How can computed variables be managed within the model table?
How do I request the generation of SAS score code?