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: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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
  • 2353 views
  • 2 likes
  • 2 in conversation