This project is a full machine learning pipeline for predicting company bankruptcy based on financial and operational features. It uses multiple classification algorithms and is deployed via Gradio and Hugging Face Spaces.
👉 Try it on Hugging Face Spaces
- Logistic Regression
- Random Forest
- XGBoost
- Multilayer Perceptron (MLP)
- Data Preprocessing
- Feature selection using
SelectKBestwith ANOVA F-test - Balancing with SMOTE
- Feature selection using
- Model Training and Evaluation
- Accuracy, Precision, Recall, F1-score, ROC AUC
- Confusion Matrix visualization
- Hyperparameter Tuning
- Interactive Prediction UI via Gradio
- Cloud Deployment using Hugging Face Spaces and AWS
bankruptcy_prediction/
├── bankruptcy_model.py # Main ML pipeline script
├── app.py # Gradio app for UI
├── requirements.txt # Python dependencies
├── model.pkl # Trained model
└── README.md # Project documentation
- Python
- scikit-learn
- xgboost
- imbalanced-learn
- Gradio
- Google Colab
- AWS (S3 & SageMaker)
- Hugging Face Spaces
- Financial dataset of companies with binary labels for bankruptcy.
- Feature selection reduced dimensions from 96 to 20 using statistical relevance.
| Model | Accuracy | Precision | Recall | F1 Score | ROC AUC |
|---|---|---|---|---|---|
| Logistic Regression | 0.87 | 0.88 | 0.85 | 0.86 | 0.92 |
| Random Forest | 0.91 | 0.92 | 0.90 | 0.91 | 0.95 |
| XGBoost | 0.93 | 0.94 | 0.92 | 0.93 | 0.97 |
| MLP Classifier | 0.89 | 0.90 | 0.87 | 0.88 | 0.94 |
Clone the repository:
git clone https://github.com/AdMub/bankruptcy-prediction.git
cd bankruptcy-predictionpip install -r requirements.txtpython app.py- Gradio App: Built for local or web-based UI.
- Hugging Face: Easily hosted with app.py and requirements.txt.
- AWS S3/SageMaker: Model files and training logs available for cloud workflows.
- Add more interpretability (e.g., SHAP or LIME)
- Improve feature engineering
- Incorporate financial ratios or temporal data
- Deploy with containerized solutions (Docker + AWS ECS)
AdMub
- 📚 University of the People & University of Ibadan
- 🔗 LinkedIn | Twitter
This project is licensed under the MIT License. See the LICENSE file for more details.
