Feature request: Feature-specific penalties
@guolinke In some applications it would be helpful to be able to penalize the use of specific features. Some features may have higher costs to obtain or are less interpretable, which can be an important consideration when the model needs to be explained to non-technical audiences.
For example, if feature1 has additional cost I may want to apply a penalty to it's split gains, which would result in that feature playing a reduced role in the model (lower feature importance) or possibly not get used at all.
One approach for implementation would be to allow the lambda_l1 and/or lambda_l2 parameters to vary by feature, which I think would achieve this result.
I'd love to get your thoughts on this.
I do primarily use the package's lgb.importance function based on split gain, but I've been meaning to test out SHAP importance. I don't think this would solve the issue, at least not in the use cases I have in mind, but I will read into this. Thanks for the tip.
I usually tune min_sum_hessian_in_leaf (and/or min_data_in_leaf) when building models. I don't think this parameter would help here since overfitting isn't the issue. I suppose increasing min_sum_hessian_in_leaf above its optimal value would limit the problematic features, but it would also limit all other features too. The hope here is to be able to single out specific features to penalize.
Including/Excluding the problematic feature entirely is currently our only option. If the feature doesn't significantly impact model predictive performance then it's an easy decision, but generally there's a tradeoff between model interpretability and model performance. It would be great to have finer control to help obtain that right balance.
@rgranvil I think it can be easily achieved. However, I am not sure about the algorithm. A per-feature L2 regularization is okay ?
@guolinke I think this would work, but I am open to other approaches if you have other ideas. If possible, can this be implemented in a new parameter as an additional l2 regularization, so the total L2 regularization is lambda_l2 + feature_L2? This might make it easier to tune lambda_l2 independently of any per-feature penalties.
I would be happy to help test.
@guolinke One other simple approach I could think of is to accept a vector of per-feature percentage penalties on the split gain, applied after any L1/L2 regularization. So for example a vector of [0.05, 0.1, 0] would reduce feature1's calculated split gains by 5%, feature2's gains by 10%, and feature3's by 0%. A vector of [0,0,0] would mean no feature-specific penalization. The user interface may be a little more intuitive with this approach, since I believe the appropriate L2 regularization would vary based on data size. I think either approach could achieve the desired result, so I'm okay with whatever you think is best.
@guolinke With a regularization per feature, it could also enable ignoring specific features (ex: using -1 for a feature to disable it?) for R / Python wrappers.
@rgranvil I think the second approach is better, I will create a PR soon. Can you help to test it ? @Laurae2 yeah, we can use it to ignore features.
@guolinke Sounds great. I'd be happy to help test.
Closed via #1449, #1484.