AboutWhat I doProjectsLabContact
  • SCIKIT-LEARN
  • CALIBRATION
  • TABULAR

Credit Risk Model

Credit Risk Model

Credit-default risk model with rigorous evaluation: a leakage-free pipeline, cross-validated model comparison, calibrated probabilities, a cost-based decision threshold and per-segment error analysis. Code at github.com/delcenjo/credit-risk.

Default prediction on the UCI Taiwan dataset: 30,000 credit-card clients with a 22% default rate. The goal was not to fit a classifier but to turn the model into a defensible lending decision: leakage-safe validation, honest metrics for an imbalanced target, calibrated probabilities and a threshold chosen by the cost of mistakes.

  • Test ROC-AUC0.779
  • PR-AUC0.562
  • Dataset30,000 clients

Comparing models without cheating

Logistic regression: 0.728 ROC-AUC and 0.505 PR-AUC. Gradient boosting: 0.781 and 0.562. Candidates are ranked by PR-AUC, not accuracy, because with 22% positives accuracy lies. The winner is evaluated once on the held-out test set: 0.779 ROC-AUC.

The threshold is worth more than the algorithm

A false negative (lending to someone who defaults) does not cost the same as a false positive (rejecting someone who would have paid). The decision threshold is chosen by minimising the expected cost under that asymmetry, and it moves the operating result more than switching models.

Where the model fails

Per-segment error analysis closes the project: looking at which subgroups concentrate the mistakes says more about the data and the features than any global metric. It was the part where I learned the most, because the errors were almost never where I expected.

Shall we connect?

Let's talk: feedback, collaboration or an opportunity.

You can write to me about a project, a technical question, to give me feedback, or about an internship or a first junior role. I always reply.

Write to me

Next projects:

Built with

PythonPyTorchscikit-learnpandasNumPyJupyterHugging FaceLangChainFastAPIPydanticDockerGitHub ActionsPrometheusGrafanaMLflowPostgreSQLGitGitHubLinuxStreamlitSQLiteAnthropicBashPyPIOllamaPythonPyTorchscikit-learnpandasNumPyJupyterHugging FaceLangChainFastAPIPydanticDockerGitHub ActionsPrometheusGrafanaMLflowPostgreSQLGitGitHubLinuxStreamlitSQLiteAnthropicBashPyPIOllama
hola@jmwebsoluciones.com