I need to remove a feature (variable) from my GBM without rebuilding the model and excluding the variable, what would be the best approach to do this?
1 Answer
If you set the column (in the data frame you give to h2o.predict
) to all NA
, then it will act as if the data is missing. According to the FAQ (and assuming you had no NAs in the training data) it will then "follow the majority direction (the direction with the most observations)".
Compared to rebuilding the model without the variable, I would expect this to give less useful results. Any interaction of that column with others will now be biased. I'd recommend rebuilding the model, and evaluating both it and your existing model with the excluded column set to NA, on the test set, to quantify that... But, of course, you had a good reason to not want to rebuild the model :-)
If the variable you are removing is gender, and your training data was 70% male, 30% female, my understanding of "majority direction" is that NAs will be treated as male. So if the reason you are removing gender from decision making is concerns over bias, this may or may not be desirable.
For a category with very few levels like gender, another possibility is to run h2o.predict
first with it set to male, then again with it set to female, and somehow merge the results. (Or inform the operator of "dependence on a sensitive variable" when the results disagree in an important way.)