Data Science Pilot Action Set
Variable Screening Using the screenVariables Action
This section contains PROC CAS code.
Note: Input data must be accessible in your CAS session, either as a CAS table or as a transient-scope table. A CAS table has a two-level name: the first level is your CAS engine libref, and the second level is the table name. You refer to this table in the CAS procedure by specifying only the second level. For more information about two-level names, see Chapter 2, Shared Concepts (SAS Viya: Machine Learning Procedures). A transient-scope table is called directly from the action and exists in memory for the duration of the action. For more information about accessing data, see SAS Viya: System Programming Guide. For more information about PROC CAS and programming in CASL, see SAS Cloud Analytic Services: CASL Programmer’s Guide and SAS Cloud Analytic Services: CASL Reference.
The following DATA step creates the reference data table mycas.dmagecr in your CAS session. These statements assume that your CAS engine libref is named mycas, but you can substitute any appropriately defined CAS engine libref.
data mycas.dmagecr;
set sampsio.dmagecr;
run;
The following statements run the screenVariables action to screen the variables by applying the specified screenPolicy parameter. The action outputs a CAS output table, screen_variables_out, that contains a recommendation for the subsequent treatment of each input variable. In this example, the inputs parameter is not specified. Hence, the action takes all variables except the target variable as the input variables. In addition, the default value of the screenPolicy parameter is used.
proc cas;
loadactionset "dataSciencePilot";
dataSciencePilot.screenVariables
/ table = "DMAGECR"
casOut = {name = "SCREEN_VARIABLES_OUT",
replace = True}
target = "good_bad"
screenPolicy = {}
;
run;
fetch / table = "SCREEN_VARIABLES_OUT";
run;
quit;
The table parameter names the input reference data table. The casOut parameter names the output data table. The target parameter names the target variable. The screenPolicy parameter specifies the screening policy.
The CAS output table is shown in Output 11.8.1.
Output 11.8.1: Feature Rank
| Selected Rows from Table SCREEN_VARIABLES_OUT | |||
|---|---|---|---|
| _Index_ | Variable | Recommendation | Reason |
| 1 | purpose | keep | passed all screening tests |
| 2 | checking | keep | passed all screening tests |
| 3 | duration | keep | passed all screening tests |
| 4 | history | keep | passed all screening tests |
| 5 | amount | keep | passed all screening tests |
| 6 | savings | keep | passed all screening tests |
| 7 | employed | keep | passed all screening tests |
| 8 | installp | keep | passed all screening tests |
| 9 | marital | keep | passed all screening tests |
| 10 | coapp | keep | passed all screening tests |
| 11 | resident | keep | passed all screening tests |
| 12 | property | keep | passed all screening tests |
| 13 | age | keep | passed all screening tests |
| 14 | other | keep | passed all screening tests |
| 15 | housing | keep | passed all screening tests |
| 16 | existcr | keep | passed all screening tests |
| 17 | job | keep | passed all screening tests |
| 18 | depends | remove | low target mutual information |
| 19 | telephon | keep | passed all screening tests |
| 20 | foreign | keep | passed all screening tests |
Variable Screening Using the screenVariables Action
This section contains Lua code for the analysis in the CASL version of this example, which contains details about the results.
Note: In order to run this code, the data that are described in the CASL version need to be accessible to the CAS server. One way to do this is to convert the dmagecr data to the comma-separated-value (CSV) file dmagecr.csv and then use the following code to load the CSV file into CAS:
s:loadtable{casLib="casuser", path="dmagecr.csv"}
For more information about coding in Lua, see Getting Started with SAS Viya for Lua and SAS Viya: System Programming Guide.
The following statements run the screenVariables action to screen the variables by applying the specified screenPolicy parameter. The action outputs a CAS output table, screen_variables_out, that contains a recommendation for the subsequent treatment of each input variable. In this example, the inputs parameter is not specified. Hence, the action takes all variables except the target variable as the input variables. In addition, the default value of the screenPolicy parameter is used.
s:loadactionset{actionset="dataSciencePilot"}
s:dataSciencePilot_screenVariables {
table = {name ="DMAGECR"},
casOut = {name = "SCREEN_VARIABLES_OUT",
replace = True}
target = "good_bad"
screenPolicy = {}
}
s:fetch{table = {name = "SCREEN_VARIABLES_OUT"}}
The table parameter names the input reference data table. The casOut parameter names the output data table. The target parameter names the target variable. The screenPolicy parameter specifies the screening policy.
For example output from the action, see the CASL code examples.
Variable Screening Using the screenVariables Action
This section contains R code for the analysis in the CASL version of this example, which contains details about the results.
Note: In order to run this code, the data that are described in the CASL version need to be accessible to the CAS server. One way to do this is to convert the dmagecr data to the comma-separated-value (CSV) file dmagecr.csv and then use the following code to load the CSV file into CAS:
m <- cas.read.csv(s, "dmagecr.csv", casOut=list(name="dmagecr"))
For more information about coding in R, see Getting Started with SAS Viya for R and SAS Viya: System Programming Guide.
The following statements run the screenVariables action to screen the variables by applying the specified screenPolicy parameter. The action outputs a CAS output table, screen_variables_out, that contains a recommendation for the subsequent treatment of each input variable. In this example, the inputs parameter is not specified. Hence, the action takes all variables except the target variable as the input variables. In addition, the default value of the screenPolicy parameter is used.
cas.loadActionSet(s,"dataSciencePilot")
cas.dataSciencePilot.screenVariables(
s,
table = list(name ="DMAGECR"),
casOut = list(name = "SCREEN_VARIABLES_OUT",
replace = True),
target = "good_bad"
screenPolicy = list()
)
cas.fetch(s, table = list(name = "SCREEN_VARIABLES_OUT"))
The table parameter names the input reference data table. The casOut parameter names the output data table. The target parameter names the target variable. The screenPolicy parameter specifies the screening policy.
For example output from the action, see the CASL code examples.
Variable Screening Using the screenVariables Action
This section contains Python code for the analysis in the CASL version of this example, which contains details about the results.
Note: In order to run this code, the data that are described in the CASL version need to be accessible to the CAS server. One way to do this is to convert the dmagecr data to the comma-separated-value (CSV) file dmagecr.csv and then use the following code to load the CSV file into CAS:
s.upload_file('dmagecr.csv')
For more information about coding in Python, see Getting Started with SAS Viya for Python and SAS Viya: System Programming Guide.
The following statements run the screenVariables action to screen the variables by applying the specified screenPolicy parameter. The action outputs a CAS output table, screen_variables_out, that contains a recommendation for the subsequent treatment of each input variable. In this example, the inputs parameter is not specified. Hence, the action takes all variables except the target variable as the input variables. In addition, the default value of the screenPolicy parameter is used.
s.loadactionset(actionset="dataSciencePilot")
s.dataSciencePilot.screenVariables(
table = {"name" : "DMAGECR"},
casOut = {"name" : "SCREEN_VARIABLES_OUT", "replace" : True},
target = "good_bad",
screenPolicy = {}
)
s.fetch(table = {"name" : "SCREEN_VARIABLES_OUT"})
The table parameter names the input reference data table. The casOut parameter names the output data table. The target parameter names the target variable. The screenPolicy parameter specifies the screening policy.
For example output from the action, see the CASL code examples.