Credit risk · Classification · Streamlit

Bankruptcy Risk Prediction

An explainable early-warning model that ranks companies by bankruptcy risk from six qualitative ratings, built for credit teams who need to focus their due diligence.

End-to-end project

The problem

Lending to a company that later goes bankrupt is expensive; refusing a healthy one loses business. A credit team needs a quick, explainable way to rank applicants by risk.

The data

250 companies with six ratings (industrial, management and operating risk, financial flexibility, credibility, competitiveness) on a low/medium/high scale, and a bankruptcy label.

Approach

  1. Caught a data-quality trap

    Only 103 of the 250 rows were unique. Training on duplicates would leak identical rows into train and test and inflate the scores, so they were removed before splitting.

  2. Handled imbalance correctly

    SMOTE applied to the training set only, after a stratified 80/20 split.

  3. Compared five models

    Logistic Regression, Decision Tree, Random Forest, Gradient Boosting and SVM, with ROC and learning curves.

  4. Tuned and deployed

    GridSearchCV / RandomizedSearchCV pipelines, then a Streamlit app where users set the ratings and get a probability.

What I found

Model results
ModelTest accuracy (21 companies)CV score (tuned)
Logistic Regression1.000.996
Random Forest1.001.000
SVM1.001.000
Decision Tree0.95–

The key insight

Near-perfect scores on 21 test companies would not hold on messy real-world credit data. The cross-validated scores and the feature analysis are the reliable part, and the explainable model is the one I'd put in front of a credit committee.

Limitations & next steps

Tools