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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 2287 views
  • 2 likes
  • 2 in conversation