Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decision Tree leaf node assignments in rpart #47

Open
wreck84 opened this issue Feb 6, 2023 · 1 comment
Open

Decision Tree leaf node assignments in rpart #47

wreck84 opened this issue Feb 6, 2023 · 1 comment

Comments

@wreck84
Copy link

wreck84 commented Feb 6, 2023

I want to create a feature/column in a dataset that indicates which leaf node a record belongs to, based on the leaf node prediction. Examining the feature values and conducting a one-way anova on the leaf nodes are the main goals.

I do not understand the rpart documentation enough to see if rpart already provides that functionality. I am self-taught in R.

I tried to create a nested series of ifelse statements one at a time to make sure I didn't flub up on the syntax, but that only worked for a while. Eventually, it got to the point where I got error messages that could not be resolved. It is a very large decision tree with 16 leaf nodes.

Performing this task in R would be best, but exporting the dataset to Excel and re-importing it into R seems to be my only alternative at the moment.

I would appreciate it if someone had any suggestions on how to complete this task in R, rpart, or some other package.

@RoelVerbelen
Copy link

You can use the rpart.predict.leaves() function from the treeClust package. See the documentation here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants