Random Forest - How to create every tree with only a certain amount of random features?
2 次查看(过去 30 天)
显示 更早的评论
Hello everyone,
I have a dataset with 10 features and I want to use treebagger to create a random forest. But I need every tree build by only randomly selecting three random features first. and not all of them. For example the first decision tree would only contain feature (1,3,6), the second tree would use feature ( 4,9,10) and so on....
At first I thought I could use 'NumPredictorsToSample' but this argument only randomly selects features for every decision split and not the whole tree.
Maybe I could combine it with other arguments to achieve a similiar effect but I'm unsure.
Sorry if I'm missing some really obvious methode that would solve my problem.
So : How can I force treebagger to randomly select a certain(same) amount of features for each individual tree?
Thanks in advance
LA
0 个评论
回答(1 个)
Prince Kumar
2021-11-23
Hi Laurynas Angelbeck,
In a random forest, variables are selected randomly for every split. However selecting a subset of predictors for the entire tree (via the subspace method) is not possible. So there aren't any workarounds when weak learners are trees.
Using the subspace method for other types of weak learners is possible. Here is an example using 'fitcensemble' with knn learners: Random Subspace Classification
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Classification Ensembles 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!