The script initiates a CAS session, loads the 'sashelp.baseball' dataset into CAS memory under the 'casuser' CASLIB, then loads the 'decisionTree' action set. It then uses the 'gbtreeTrain' action to build a Gradient Boosting model. The model is configured with various options such as POISSON distribution, early stopping based on 'LOGLOSS', and variable importance. The trained model is saved as a CAS table 'GRADBOOST3'.
Data Analysis
Type : SASHELP
The source data comes from SAS's built-in 'sashelp.baseball' dataset, which is then loaded and processed in CAS memory under the 'casuser' CASLIB.
1 Code Block
DATA STEP Data
Explanation : This code block initializes a CAS session and makes all CASLIBs available. A DATA STEP is then used to load the 'sashelp.baseball' dataset into CAS memory under the 'casuser' CASLIB, thereby creating a working copy of the 'baseball' table in CAS memory.
Copied!
cas;
caslib _all_ assign;
data casuser.baseball;
set sashelp.baseball;
run;
1
cas;
2
caslib _all_ assign;
3
4
DATA casuser.baseball;
5
SET sashelp.baseball;
6
RUN;
2 Code Block
PROC CAS
Explanation : This block uses PROC CAS to load the 'decisionTree' action set. This action set provides the necessary actions for building and training decision tree models, including the Gradient Boosting action that will be used later.
Copied!
proc cas;
loadactionset 'decisionTree';
quit;
1
PROC CAS;
2
LOADACTIONSET'decisionTree';
3
QUIT;
3 Code Block
PROC CAS Data
Explanation : This block sets the default CASLIB to 'casuser' and then uses the 'gbtreeTrain' action from the 'decisionTree' action set via PROC CAS. This action trains a Gradient Boosting model on the 'baseball' table (casuser.baseball), targeting the 'logSalary' variable. It specifies a list of numerical and nominal input variables, uses a POISSON distribution, and includes options for early stopping (based on LOGLOSS), name encoding, greedy selection, handling missing values, Lasso regularization, leaf size, learning rate, and variable importance calculation. The trained model is saved in a new CAS table named 'GRADBOOST3'.
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.