The HPDECIDE Procedure
Example 6.2 Running with Client Data in Distributed Mode
This example demonstrates how to use PROC HPDECIDE to make decisions when the type of the decision data set is LOSS and the target is continuous. When the input data set resides on the client and a PERFORMANCE statement with a NODES= option is specified, as in the following statements, PROC HPDECIDE copies the data set to the SAS appliance, where the computation is performed:
data data2;
input tar p ;
DATALINES;
1 6
2 2
3 1
3 4
4 2
5 0
3 3
6 2
7 1
3 5
;
data decdata2(type=loss);
input dv1 dv2 dv3 tar ;
DATALINES;
0 0 3 0
1 0 2 1
0 2 1 2
0 3 0 3
;
The following statements take as input the data2 and decdata2 data sets (which reside on the client) and output the out2 and outstat2 data sets. The decision variables are dv1, dv2, and dv3, and the target variable is tar. Because five grid nodes are specified in the PERFORMANCE statement, the input data sets are distributed from the client to the five grid nodes, which perform the computations and then write the output data sets back to the client.
proc hpdecide data=data2 out=out2 outstat=outstat2;
decision decdata=decdata2 decvars=dv1-dv3;
predicted p;
target tar;
performance details nodes=5 nthreads=8
host="&GRIDHOST" install="&GRIDINSTALLLOC";
run;
proc print data=out2;
run;
proc print data=outstat2;
run;
Output 6.2.1 shows the out2 data set, which displays the decision for each observation. For each observation, the continuous target variable was interpolated.
Output 6.2.1: out2 Data Set
| Obs | p | dv1 | dv2 | dv3 | D_DECDATA2 | EL_DECDATA2 | CL_DECDATA2 | BL_DECDATA2 | _WARN_ |
|---|---|---|---|---|---|---|---|---|---|
| 1 | 6 | 0 | 6 | -3 | dv3 | -3 | 2 | 0 | |
| 2 | 2 | 0 | 2 | 1 | dv1 | 0 | 0 | 0 | |
| 3 | 1 | 1 | 0 | 2 | dv2 | 0 | 3 | 0 | |
| 4 | 4 | 0 | 4 | -1 | dv3 | -1 | 0 | 0 | |
| 5 | 2 | 0 | 2 | 1 | dv1 | 0 | 0 | -1 | |
| 6 | 0 | 0 | 0 | 3 | dv1 | 0 | 0 | -2 | |
| 7 | 3 | 0 | 3 | 0 | dv1 | 0 | 0 | 0 | |
| 8 | 2 | 0 | 2 | 1 | dv1 | 0 | 0 | -3 | |
| 9 | 1 | 1 | 0 | 2 | dv2 | 0 | 7 | -4 | |
| 10 | 5 | 0 | 5 | -2 | dv3 | -2 | 0 | 0 |
Output 6.2.2 shows the outstat2 data set, which shows that the total loss is 0 and the average loss is 0, based on the decisions from the out2 data set.
Output 6.2.2: outstat2 Data Set
| Obs | _LOSS_ | _ALOSS_ |
|---|---|---|
| 1 | 12 | 1.2 |
Output 6.2.3 shows the performance information.
Output 6.2.3: Performance Information
| Performance Information | |
|---|---|
| Host Node | << your grid host >> |
| Install Location | << your grid install location >> |
| Execution Mode | Distributed |
| Number of Compute Nodes | 5 |
| Number of Threads per Node | 8 |
Output 6.2.4 shows the timing information.
Output 6.2.4: Timing Information
| Procedure Task Timing | ||
|---|---|---|
| Task | Seconds | Percent |
| Startup of Distributed Environment | 1.22 | 98.34% |
| Data Transfer from Client | 0.00 | 0.21% |
| Computation | 0.00 | 0.05% |
| Writing Output | 0.02 | 1.39% |