2
$\begingroup$

I'm running a Gradient Boosting Regressor using scikit-learn. Within my features, I have a categorical feature (let's say Res), with 4 categories. I'm doing dummy variables to evaluate categorical features. S feature category is the most important feature according to regressor feature importance.

I'm evaluating my regressor, assessing some metrics for different test datasets. I've got one test dataset for every category of the referred feature (Res). I mean, I've got a dataset where all the values of the Res feature are S. I'm obtaining the poorest performance in the dataset that corresponds to the most important category.

Does it make sense?

$\endgroup$

1 Answer 1

2
$\begingroup$

Yes, it makes sense to have the poorest performance in a particular test set, as nothing guarantees that performance is stable across different test-sets. Having the values of Res being S might be overall important but it does not necessitate that having S values is a prerequisite for good model performance.

Assuming we use "standard" feature importance calculate, ie. based on impurity reduction, the importance of a feature reflects the (normalized) total reduction of the criterion brought by that feature. This feature important though is contingent to interactions with other features and does not mean that simply having a particular feature value gives us good or bad performance individually. What you observed is therefore not entirely unexpected, it might be a bit unusual but definitely not impossible.

You might also want to consider looking into permutation importance and/or SHAP values to get another lens on the model's feature importances and how they affect the overall predictions.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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