ing-bank / skorecard

scikit-learn compatible tools for building credit risk acceptance models
https://ing-bank.github.io/skorecard/
MIT License
82 stars 23 forks source link

Add feature importance method to Skorecard class #7

Open orchardbirds opened 3 years ago

orchardbirds commented 3 years ago

The feature importance in the context of the skorecard model is the feature IV*coef of the logistic regression.

Let's make this calculation within the skorercard class In terms of code, it's similar to this

X_train_bins = scorecard.bucket_transform(X_train)
iv_dict = iv(X_train_bins, y_train)

iv_values = pd.Series(iv_dict).sort_values(ascending=False)
iv_values.name="IV"

feat_importance = model_stats[['Coef.']].join(iv_values)
feat_importance['importance'] = -1.*feat_importance['Coef.']*feat_importance['IV']
feat_importance.sort_values(by='importance', ascending=False)
timvink commented 3 years ago

We also then need to update docs/tutorials/3_skorecard_models.ipynb, this section:

image

satya-pattnaik commented 3 years ago

Also a suggestion, the coefficients have their own intervals(usually 5% and 95%), it would be great to have a weight plot. I would like to contribute in this issue.

orchardbirds commented 2 years ago

@satya-pattnaik This sounds like a really nice idea. If you like, I can open a separate issue for this and assign you to it?

satya-pattnaik commented 2 years ago

Sounds good, you can assign it to me @orchardbirds .

anilkumarpanda commented 1 year ago

Hey @orchardbirds @satya-pattnaik do you still plan to work on this issue ? Let me know how we can help you.

rishabsinghh commented 1 year ago

Hi is this issue still open, i would like to work on it

ReinierKoops commented 1 year ago

@rishabsinghh awesome, I believe so. What do you think @anilkumarpanda ?

rishabsinghh commented 1 year ago

Whats the update? can i ?

ReinierKoops commented 1 year ago

Yes

anilkumarpanda commented 1 year ago

Hi @rishabsinghh thanks for picking this up.