BookmarkSubscribeRSS Feed
Adrian10
Calcite | Level 5

Hi all!

 

I need to force a variable in a decision tree. My code is the following:

 

proc hpsplit data = &lib..bds_vars maxdepth = 4 maxbranch = 4 nodestats=DT_1
target ind_default_7;

input risk_level/*the one whom is relevant*/ cliente_type/*the one I need to force*/  ;
code file="%sysfunc(pathname(work))/model_dtree.sas"; 
rules file="C:\Users...\Results\rules_dtree.txt";
output importance = imporvar; 
run;

NOTE. the criterion choosen is ENTROPIA (SAS default criterion)

 

Thanks a lot,

AP

1 REPLY 1
H
Pyrite | Level 9 H
Pyrite | Level 9

I don't have a direct solution for you. I was personally trying to force a certain tree to be used. Of note, the leaves option below will create a tree with set number of terminal nodes, not sure that may help you or others. Also, a weird way to force a split in,  may be to just split your data into two sets and fit two trees. But I am sure that probably won't address what you are trying to do.

 

 

prune costcomplexity (leaves=10);

 

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!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

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