BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jackmelbourne
Fluorite | Level 6

Hello Everyone,

 

After using the PROC HPSPLIT, a decision tree with at depth of 10 is returned. However, SAS only shows the first three splits from Node=0 and the whole tree cannot be viewed. How do I view the entire decision tree? Also, I would like to see the number of observations at each node. How do would I see that?

 

Thanks a lot!

 

Jack

1 ACCEPTED SOLUTION

Accepted Solutions
DougWielenga
SAS Employee

On the PROC HPSPLIT statement, there is a PLOTS option that will allow you to open up the subtree where you start and to a set depth.  In complex trees, you will not be able to reasonably see the entire tree in one plot without losing many details.  The code below refers to the SAMPSIO.HMEQ data set which is available as a sample data set in SAS Enterprise Miner and is also attached here. The code requests the displayed Tree to have a depth of 5 beginning from node "3":

 

/*** BEGIN SAS CODE ***/

 

 

libname x 'c:\data';   * < note: change libname and path as needed > ;

 

proc hpsplit data=x.hmeq seed=123 maxdepth=10 plots=(zoomedtree(nodes=("3") depth=5));

   class bad reason job;

   model bad (event='1') = debtinc derog loan mortdue value job reason clno ninq yoj;

   grow entropy;

   prune off;* costcomplexity(leaves=all);

run;

 

/*** END SAS CODE ***/

 

I hope this helps!

Doug

 

View solution in original post

1 REPLY 1
DougWielenga
SAS Employee

On the PROC HPSPLIT statement, there is a PLOTS option that will allow you to open up the subtree where you start and to a set depth.  In complex trees, you will not be able to reasonably see the entire tree in one plot without losing many details.  The code below refers to the SAMPSIO.HMEQ data set which is available as a sample data set in SAS Enterprise Miner and is also attached here. The code requests the displayed Tree to have a depth of 5 beginning from node "3":

 

/*** BEGIN SAS CODE ***/

 

 

libname x 'c:\data';   * < note: change libname and path as needed > ;

 

proc hpsplit data=x.hmeq seed=123 maxdepth=10 plots=(zoomedtree(nodes=("3") depth=5));

   class bad reason job;

   model bad (event='1') = debtinc derog loan mortdue value job reason clno ninq yoj;

   grow entropy;

   prune off;* costcomplexity(leaves=all);

run;

 

/*** END SAS CODE ***/

 

I hope this helps!

Doug

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to choose a machine learning algorithm

Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 1665 views
  • 2 likes
  • 2 in conversation