1
$\begingroup$

Trying to understand completely how does random forest work and playing with it a bit, I came across the importance() function here on sklearn. This function has made random forests now as one of my go-to models. But I can't really understand how does the function implement and calculate this beautiful utility.

Any explanation would be golden!

$\endgroup$
0
$\begingroup$

Each tree is constructed using a different bootstrap sample from the original data. About one-third of the cases are left out of the bootstrap sample and not used in the construction of the kth tree.

In every tree grown in the forest, put down the oob cases and count the number of votes cast for the correct class. Now randomly permute the values of variable m in the oob cases and put these cases down the tree. Subtract the number of votes for the correct class in the variable-m-permuted oob data from the number of votes for the correct class in the untouched oob data. The average of this number over all trees in the forest is the raw importance score for variable m.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.