SOFTWARE/CART

 



by

TreeCoder Model Deployment Module

TreeCoder is an add-on module for deploying CART models directly in SAS® quickly and accurately.

The decision logic of a CART tree, including the surrogate rules utilized if primary splitting values are missing, is automatically implemented. The resulting source code can be dropped into a SAS run without modification thus eliminating errors due to hand coding of decision rules and enabling fast and accurate model deployment.

Critical for using your CART trees in large scale production work, TreeCoder takes as input some or all of the predictor variables and outputs the terminal node assignment and predicted response. The SAS code produced is organized into one segment per node, with each node segment consisting of the following:

  • node label
  • definitions for macro variables giving the numbers of the left and right child nodes, and of either of these nodes is terminal, the predicted value of the dependent variable for that node
  • rule for determining whether an observation is assigned to the left or right child node (if the assigned child node is terminal, the variable NODE is set to the number of the terminal node assignment and RESPONSE is set to the predicted value of the dependent variable for that node; otherwise, control is transferred to the code segment for the assigned node)
  • RETURN statement

Example of output produced automatically by the TreeCoder:


%let depvar=MONFEE; 
%macro termnode(node,value);
do;
node=&node;
response=&value;
end
%mend;


NODE1:
%let left=2;
%let right=16;
if IPAKPRIC~=. then do;
if IPAKPRIC<=10.146 then goto NODE&left;
else goto NODE&right;
end;
else if NFAMMEM~=. then do;
if NFAMMEM<=6.500 then goto NODE&left;
else goto NODE&right;
end;
else if DRINK~=. then do;
if DRINK<=1.500 then goto NODE&left;
else goto NODE&right;
end;
else if FIT~=. then do;
if FIT<=9.235 then goto NODE&left;
else goto NODE&right;
end;
else if CLOTHIN~=. then do;
if CLOTHIN<=0.500 then goto NODE&left;
else goto NODE&right;
end;
else if NSUPPS~=. then do;
if NSUPPS<=42.500 then goto NODE&left;
else goto NODE&right;
end;
else goto NODE&left;
return;
NODE2:
%let left=3;
%let right=4;
if NSUPPS~=. then do;
if NSUPPS<=5.500 then goto NODE&left;
else goto NODE&right;
end;
else if ONAER~=. then do;
if ONAER<=0.500 then goto NODE&left;
else goto NODE&right;
end;
else if CLUSTER~=. then do;
if CLUSTER<=9.500 then goto NODE&right;
else goto NODE&left;
end;
else if OFFAER~=. then do;
if OFFAER<=3.500 then goto NODE&right;
else goto NODE&left;
end;
else if IPAKPRIC~=. then do;
if IPAKPRIC<=5.313 then goto NODE&left;
else goto NODE&right;
end;
else if SAERDIF~=. then do;
if SAERDIF<=0.500 then goto NODE&left;
else goto NODE&right;
end;
else goto NODE&right;
return;

etc.

The next release of TreeCoder will also generate C compatible programming statements. Please contact us for more information.

© Copyright 2010 Salford-Systems Inc.


 
Copyright © 2010 TStat All rights reserved via Rettangolo, 12/14 - 67039 - Sulmona (AQ) - Italia