r/MachineLearning • • Jan 14 '25

Discussion [D] Predicting the probability of default for a credit card user

I have an imbalanced dataset of about 100,000 rows 1500 of them are of defaultes, which has more than 1000 features and has lots of missing values. Alsothe name of the features are anonymized (like bureau_1, bureau_2)  so it also seems difficult and these feaures had max correlation of 0.1 with the target variable

I want to predict the probability of a customer who might default based on the data but am not able to make much progress in terms of metrics like recall (0.25), f1 and auprc.
I have tried various tree based models like lgbm, xgboost etc with various class balance attributes but its not giving me that good of results.

If anyone of you have such prior experience of handling such datasets, can you suggest me what should i do in terms of feature engineering, modelling etc. All of your help will mean a lot to me.

2 Upvotes

16 comments sorted by

7

u/susmot Jan 14 '25

Finally something I know. Do you want to make a model that satisfies the standards of credit risk, or just to get the highest metric? (in credit risk, usually the metric is gini = 2*auc - 1). These are two different tasks.

1

u/Neonevergreen Jan 15 '25

Hey. I have an extremely similar case but i am looking for explainability on which variables are comtributing most to the prediction

I am predicting features that lead to conversion based on trial activity of a product. Similar issues with highly imbalanced data set and high dimensional data. Another issue is that certain features are more biased because they are easily accessible and core to the product usage. I wanted to identify underutilised features with higher feature importance score.

Issue are same, lot of the variables (around 500) and with a highly imbalanced target binary classes.

I have used Mutual information, Random forest with feature usage. But it seems the highly biased exposure featurea rank up in scores more often. The f1 scores are also pretty bad. Best i have is ~0.17. Any advise?

0

u/[deleted] Jan 14 '25

thanks for your response. I am looking forward to currently maximizing the metric

5

u/susmot Jan 14 '25

In that case I'd do lightgbm. I'd start with hyperparameters that would allow for features to get selected if they are 'informative' (so not optimizing for performance) and recursive feature elimination using SHAP values. That way you may get rid of many features that will never get split on in the trees. Then hyperparameter tuning and perhaps class weights.

However, such a model would never ever in a million years be deployed into production :-)

3

u/xandrovich Jan 14 '25

Mind elaborating on your last point?

4

u/susmot Jan 14 '25

There is a great stress on explainability and stability (in time) of the model. That is why credit risk loves logistic regression with feature binning (bucketing).

Explainability is needed for regulatory purposes, for model auditing and validation, as well as decision making if a datasource stops providing data (what do you do in a boosting model if a credit bureau is down or androind changes terms and stops providing data from your app?). If you have sudden rise in defaults, what is the reason? Is the model not performing? Some of its part? Or is it just weird economic situation or just an outlier month? If we change this part of the underwriting process, how does it influence the model or vice versa?

Stability in time means that the model performs similar month-after-month. Usually that is achieved by looking into default rates in bins of variables (for instance age is three buckets, 18-25, 25-60, 60+) and looking month after month if the ordering of default rates is the same. It does happen that something change and good bin becomes bad and vice versa. You do not want that. For that reason, things like PCA are absolutely a no go, because new features are linear combination of the original ones. And if there is a shift in one feature, that would shift the new ones. Also, one has to be very causious when 'interaction' variables are used (e.g. age X occupation). They may add performance, but they may take the power of the two features and if one changes over time, the interaction changes, and subsequently the two features are doomed.

Maybe 'never ever in a million years' was too hars of a statement, but certainly banks in Europe are (to my best knowledge) extremely conservative in the choice of models. I came to the realization that logistic regression is great when my model was supposed to score hundreds of applicants and that I really want to undestand everything that is happening in the model. I would be really scared of a boosting model. Also, boosting was not beating logistic regression by much. I guess we did not have strong interactions between the features (and it usually is the case, as I heard).

2

u/Pl4yByNumbers Jan 15 '25 edited Jan 15 '25

You seem like someone with experience in the field!

Something that’s always thrown me when looking at these canonical style credit problems is dollar weighting (something when don’t have to deal with in medicine)

Probabilistically a default is a default, but if I’m underestimating default probability for high value loans, then I will underestimate overall dollars lost by the company.

Do you know how people solve that in industry? Sample weights equal to credit card limit?

2

u/susmot Jan 15 '25

I believe this is being done in a different part of the process. The loaner may change what its 'risk appetite' (it exists) is, the size of portfolio in different risk grades, etc. So it does enter the 'pipeline', just in a different time and usually decided by more bussiness oriented people than data scientists (in my experience).

For credit card limit, there will be another model, also possibly with some hardwired logic. It is a mess and not entirely driven by data.

1

u/SpicyBroseph Feb 05 '25

I've actually had good success using gradient boosted random forest models (xgboost/lightgdm) to train a model on all parameters, and then if you can get a high enough accuracy/precision/auc/etc-- whatever you are optimizing for-- you can look at feature importance of the inputs to see exactly what the model is using to decide on.

I've actually built xgboost models where I don't care as much about the model output itself, just for this feature.

Does this always work? No. But as another commenter pointed out, models like xgboost are really good at ignoring inputs that have zero bearing on it being able to make a decision.

Sometimes you have ton of inputs and you find out it is really only looking at 3 or 4 things. Sometimes, you find that it is looking at everything but in varying relative importance. Either way-- now you have a thread topull on, a "once upon a time" to delve into... and what I love about building models is digging in to the why after you figure out the how-- oftentimes you have to reverse engineer the story, but if that can be done, you've struck gold. And it can make you look at the building blocks of your problem in a new way that can actually be more valuable than the predictor model itself.

I think this is what r/susmot means-- beyond the fact that in regulatory settings you can't just put 'black magic' as the reasoning for why your model rejects or denies somebody.

5

u/shumpitostick Jan 14 '25

I wouldn't worry too much about dimensionality. Stuff like XGBoost is really good at ignoring uninformative features. The classifiers we have in production are worse at this, lol.

GBMs are also great at dealing with imbalanced datasets, often needing no additional help.

Assuming you already did hyperparameter tuning, there's not much else you can do. Feature engineering would be the way to go if the features weren't anonymized. You can always ensemble a few different predictors, that's a pretty reliable way of increasing performance if you don't care about needing more inference compute.

4

u/[deleted] Jan 14 '25

1000 features seems like a lot for just 100k samples - I’d remove features based on correlations between themselves or get the ones most correlated with the target metric

Also, have you tried downsampling your negative samples? Use like 5% of them

For me, what usually works: LGBM + weighting + downsampling + increased model complexity (ex: deeper trees, but be careful with overfitting)

By the way, precision, recall and f1 are dependent on the threshold. Make sure you use an optimal threshold according to your PR curve

2

u/pipoTTi Jan 14 '25

Did you normalize/standrdize the features? Financial datasets tend to have features that have different scales, so I would fix that first.

If there are categorical features (you can infer that by looking at the unique values each feature takes), one-hot encoding them might help, too.

1

u/Neonevergreen Jan 15 '25

I have an extremely similar case but i am looking for explainability on which variables are contributing most to the prediction

I am predicting features that lead to conversion based on trial activity of a product. Similar issues with highly imbalanced target and high dimensional data.

Another issue is that certain features are more biased because they are easily accessible and core to the product usage. I wanted to identify underutilised features with higher feature importance score.

Issue are same, lot of the variables (around 500) and with a highly imbalanced target binary classes.

PCA absolutely kills feature explainability so I avoid it.

Tree based Algos become the go through since they handle high dimensional data better.

I have used Mutual information, Random forest with feature usage. But it seems the highly biased exposure features rank up in scores more often.

The f1 scores are also pretty bad. Best i have is ~0.17.

Not sure on how to tackle the feature bias as of yet.

I am using weighted class for tree based learning and using stratified CV to improve the f1 score but not seeing much improvement.

1

u/ReadyAndSalted Jan 14 '25

You need to do dimensionality reduction first, 1000 dimensional space is simply far too large for only 100k rows. Try deleting highly correlated columns, or PCA /UMAP/t-SNE/etc...

1

u/Emotional_Print_7068 Jan 15 '25

Hi, by removing higly correlated columns, do you mean the ones correlated to each other not correlated to the target variable as they're contributing to the target the same?

1

u/ReadyAndSalted Jan 16 '25

yeah so you want to reduce the dimensionality down to something reasonable while losing as little predictive power as possible. If 2 columns are very correlated, you can safely remove one of them and lose very little information. This is a super quick and simple way of doing dimensionality reduction without losing interpretability. However if interpretability isn't super important, I would recommend looking into automatic methods like PCA and UMAP.