Why impurity based feature Importances can be misleading for high cardinality features?

Why impurity based feature Importances can be misleading for high cardinality features?

impurity-based importances are biased towards high cardinality features; impurity-based importances are computed on training set statistics and therefore do not reflect the ability of feature to be useful to make predictions that generalize to the test set (when the model has enough capacity).

What are the importance of determining the features of random forest?

Feature importance is calculated as the decrease in node impurity weighted by the probability of reaching that node. The node probability can be calculated by the number of samples that reach the node, divided by the total number of samples. The higher the value the more important the feature.

What are high cardinality features?

What is high cardinality? A categorical feature is said to possess high cardinality when there are too many of these unique values. One-Hot Encoding becomes a big problem in such a case since we have a separate column for each unique value (indicating its presence or absence) in the categorical variable.

How do you deal with high cardinality features?

Below is a simple function I use to reduce the cardinality of a feature….Leave instances belonging to a value with high frequency as they are and replace the other instances with a new category which we will call other.

  1. Choose a threshold.
  2. Sort unique values in the column by their frequency in descending order.

Which is the most important feature in the random forest?

The impurity-based feature importance ranks the numerical features to be the most important features. As a result, the non-predictive random_num variable is ranked the most important! This problem stems from two limitations of impurity-based feature importances: impurity-based importances are biased towards high cardinality features;

Why are binary features important in a random forest?

This is because these kinds of variables, because of their nature have a higher chance of appearing more than once in an individual tree, which contributes to an increase in their importance. If a binary feature is really relevant though, it will still be reflected in the feature importance ranking [1].

What does negative importance mean in a random forest?

First of all, negative importance, in this case, means that removing a given feature from the model actually improves the performance. So this is nice to see in the case of random, but what is weird is that the highest performance boost can be observed after removing DIS, which was the third most important variable in previous approaches.

How many decision trees are in a random forest?

Random forests consist of 4 –12 hundred decision trees, each of them built over a random extraction of the observations from the dataset and a random extraction of the features. Not every tree sees all the features or all the observations, and this guarantees that the trees are de-correlated and therefore less prone to over-fitting.