How alirezaahmadibeni/bankruptcy-prediction works
Project type and purpose
• This is a Python-based data-science/ML research pipeline (targeting Python 2.7) that demonstrates and visualizes two meta-heuristic algorithms (Genetic Algorithm, Grey Wolf Optimization) for cluster-based undersampling and training of an Artificial Neural Network (ANN) to predict corporate bankruptcy.
• It is not a full-stack web app but rather a command-line/experimental framework with a clear sequence: data loading → sampling/optimization → model training → analysis/visualization.
File structure
Top-level files and directories:
• 1year.arff, xclara.csv – input datasets
• ann.py – code defining/controlling the ANN model and training routines
• ga/ – package containing GA logic (ga.py for core GA, crossover.py for operators)
• gwo/ – package containing Grey Wolf Optimization logic (gwo.py)
• main.py – orchestrator that ties data, sampling algorithms, ANN training, and evaluation together
• README.ME – project description and dataset info
Extract architecture hints from the README
• The README confirms the focus on “Optimization of cluster-based evolutionary undersampling for ANN” using GA and GWO.
• It references a UCI dataset for bankruptcy prediction, implying the data-loading module must handle ARFF/CSV.
• There is no mention of external services—this is a standalone pipeline.
Components & relationships
a. Main Components
1. Data Layer
• Raw data sources: 1year.arff, xclara.csv
• Preprocessing submodule (could live inside main.py or ann.py)
2. Sampling/Optimization Layer
• Genetic Algorithm package (ga/)
• Grey Wolf Optimization package (gwo/)
3. Modeling Layer
• Artificial Neural Network module (ann.py)
4. Orchestration Layer
• main.py – invokes data loading → runs each optimizer → retrains ANN → collects metrics
5. Visualization Layer
• plot_kmeans_silhouette_analysis.py (for cluster evaluation)
• Any plotting inside main.py or ann.py for training curves, performance metrics
6. Outputs
• Saved model performance metrics, cluster analysis plots, console logs
b. Relationships & data flow
• Data Layer → Preprocessing → passes cleaned data to Orchestration
• Orchestration (main.py) calls Sampling/Optimization Layer (GA and GWO)
• Each optimizer returns an “undersampled” dataset variant → passed to Modeling Layer
• Modeling Layer trains ANN on that variant → returns performance metrics
• Orchestration collects all metrics → passes to Visualization Layer → generates plots
c. Architectural patterns/design principles
• Modular packages for each algorithm (separation of concerns)
• A single orchestrator script to avoid tight coupling between modules
• Reusable data-loading/preprocessing for both GA and GWO paths
• Clear separation between algorithm logic and model training
d. Key technologies/frameworks
• Python 2.7
• NumPy, SciPy, scikit-learn (implied for clustering, silhouette analysis)
• matplotlib or seaborn (for plotting)
• Possibly liac-arff or similar for ARFF parsing