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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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