# mainak9093/company_bankruptcy_modelling architecture

> Architecture diagram of the GitHub repository mainak9093/company_bankruptcy_modelling, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mainak9093/company_bankruptcy_modelling
- Repository: https://github.com/mainak9093/company_bankruptcy_modelling

## Overview

This repository is a reproducible bankruptcy-risk modeling project, not a hosted service. Its main workflow loads labeled financial data, fits a leakage-safe preprocessing and modeling pipeline, tunes a decision threshold on validation data, and evaluates on held-out data. Separate entry points provide cross-validation, baseline comparisons, inference, labeled-data scoring, and report-figure generation. The graph follows documented workflows and shown imports/calls; some pipeline internals and report-generation details are only partially excerpted.

Main entry points: [`src/pipeline.py`](https://github.com/mainak9093/company_bankruptcy_modelling/blob/main/src/pipeline.py) (Fold pipeline), [`src/baselines.py`](https://github.com/mainak9093/company_bankruptcy_modelling/blob/main/src/baselines.py) (Baseline comparison), [`src/predict.py`](https://github.com/mainak9093/company_bankruptcy_modelling/blob/main/src/predict.py) (Prediction), [`src/train.py`](https://github.com/mainak9093/company_bankruptcy_modelling/blob/main/src/train.py) (Holdout training)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Experiment workflows"]
  node_train["Holdout training<br/>[train.py]"]
  node_cross_validation["Cross-validation<br/>[cross_validate.py]"]
  node_baselines["Baseline comparison<br/>[baselines.py]"]
end

subgraph group_pipeline["Model pipeline"]
  node_pipeline["Fold pipeline<br/>[pipeline.py]"]
  node_cleaning["Data cleaning"]
  node_selection["ANOVA selection"]
  node_training["Model training<br/>[model_training.py]"]
  node_evaluation["Metrics and threshold"]
  node_config["Settings<br/>[config.py]"]
end

subgraph group_serving["Scoring and artifacts"]
  node_artifact_store[("Saved artifacts")]
  node_prediction["Prediction<br/>[predict.py]"]
  node_scoring["Labeled scoring<br/>[evaluate.py]"]
end

subgraph group_reporting["Reporting"]
  node_figures["Report figures"]
  node_results["Experiment results"]
end

node_user(("Analyst"))
node_training_data["Labeled data"]
node_inference_data["Scoring CSV"]

node_user -->|"runs"| node_train
node_training_data -->|"loads"| node_train
node_train -->|"builds fold"| node_pipeline
node_train -->|"formats metrics"| node_evaluation
node_train -->|"saves models"| node_artifact_store
node_train -->|"writes holdout"| node_results
node_user -->|"runs"| node_cross_validation
node_training_data -->|"loads"| node_cross_validation
node_cross_validation -->|"builds folds"| node_pipeline
node_cross_validation -->|"writes summaries"| node_results
node_user -->|"runs"| node_baselines
node_training_data -->|"loads"| node_baselines
node_baselines -->|"fits cleaner"| node_cleaning
node_baselines -->|"selects features"| node_selection
node_baselines -->|"fits baselines"| node_training
node_baselines -->|"tunes and scores"| node_evaluation
node_baselines -->|"writes comparison"| node_results
node_pipeline -->|"cleans splits"| node_cleaning
node_pipeline -->|"selects features"| node_selection
node_pipeline -->|"scales and fits"| node_training
node_pipeline -->|"tunes and evaluates"| node_evaluation
node_pipeline -->|"reads settings"| node_config
node_user -->|"runs"| node_prediction
node_inference_data -->|"loads"| node_prediction
node_prediction -->|"loads artifacts"| node_artifact_store
node_prediction -->|"transforms inputs"| node_cleaning
node_prediction -->|"selects columns"| node_selection
node_prediction -->|"gets probabilities"| node_training
node_user -->|"runs"| node_scoring
node_inference_data -->|"loads labeled CSV"| node_scoring
node_scoring -->|"prepares features"| node_prediction
node_scoring -->|"gets probabilities"| node_training
node_scoring -->|"computes metrics"| node_evaluation
node_user -->|"runs"| node_figures
node_training_data -->|"loads"| node_figures
node_figures -->|"builds fold"| node_pipeline

click node_train "https://github.com/mainak9093/company_bankruptcy_modelling/blob/main/src/train.py"
click node_cross_validation "https://github.com/mainak9093/company_bankruptcy_modelling/blob/main/src/cross_validate.py"
click node_baselines "https://github.com/mainak9093/company_bankruptcy_modelling/blob/main/src/baselines.py"
click node_pipeline "https://github.com/mainak9093/company_bankruptcy_modelling/blob/main/src/pipeline.py"
click node_cleaning "https://github.com/mainak9093/company_bankruptcy_modelling/blob/main/src/data_preprocessing.py"
click node_selection "https://github.com/mainak9093/company_bankruptcy_modelling/blob/main/src/feature_selection.py"
click node_training "https://github.com/mainak9093/company_bankruptcy_modelling/blob/main/src/model_training.py"
click node_evaluation "https://github.com/mainak9093/company_bankruptcy_modelling/blob/main/src/model_evaluation.py"
click node_config "https://github.com/mainak9093/company_bankruptcy_modelling/blob/main/src/config.py"
click node_artifact_store "https://github.com/mainak9093/company_bankruptcy_modelling/tree/main/models"
click node_prediction "https://github.com/mainak9093/company_bankruptcy_modelling/blob/main/src/predict.py"
click node_scoring "https://github.com/mainak9093/company_bankruptcy_modelling/blob/main/src/evaluate.py"
click node_figures "https://github.com/mainak9093/company_bankruptcy_modelling/blob/main/src/make_report_figures.py"
click node_results "https://github.com/mainak9093/company_bankruptcy_modelling/tree/main/results"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_train,node_cross_validation,node_baselines toneBlue
class node_pipeline,node_cleaning,node_selection,node_training,node_evaluation,node_config toneAmber
class node_artifact_store,node_prediction,node_scoring toneMint
class node_figures,node_results toneRose
class node_user,node_training_data,node_inference_data toneIndigo
```

## Components

### Experiment workflows

- [Holdout training](https://github.com/mainak9093/company_bankruptcy_modelling/blob/main/src/train.py): `src/train.py`
- [Cross-validation](https://github.com/mainak9093/company_bankruptcy_modelling/blob/main/src/cross_validate.py): `src/cross_validate.py`
- [Baseline comparison](https://github.com/mainak9093/company_bankruptcy_modelling/blob/main/src/baselines.py): `src/baselines.py`

### Model pipeline

- [Fold pipeline](https://github.com/mainak9093/company_bankruptcy_modelling/blob/main/src/pipeline.py): `src/pipeline.py`
- [Data cleaning](https://github.com/mainak9093/company_bankruptcy_modelling/blob/main/src/data_preprocessing.py): `src/data_preprocessing.py`
- [ANOVA selection](https://github.com/mainak9093/company_bankruptcy_modelling/blob/main/src/feature_selection.py): `src/feature_selection.py`
- [Model training](https://github.com/mainak9093/company_bankruptcy_modelling/blob/main/src/model_training.py): `src/model_training.py`
- [Metrics and threshold](https://github.com/mainak9093/company_bankruptcy_modelling/blob/main/src/model_evaluation.py): `src/model_evaluation.py`
- [Settings](https://github.com/mainak9093/company_bankruptcy_modelling/blob/main/src/config.py): `src/config.py`

### Scoring and artifacts

- [Saved artifacts](https://github.com/mainak9093/company_bankruptcy_modelling/tree/main/models): `models`
- [Prediction](https://github.com/mainak9093/company_bankruptcy_modelling/blob/main/src/predict.py): `src/predict.py`
- [Labeled scoring](https://github.com/mainak9093/company_bankruptcy_modelling/blob/main/src/evaluate.py): `src/evaluate.py`

### Reporting

- [Report figures](https://github.com/mainak9093/company_bankruptcy_modelling/blob/main/src/make_report_figures.py): `src/make_report_figures.py`
- [Experiment results](https://github.com/mainak9093/company_bankruptcy_modelling/tree/main/results): `results`

### Other components

- **Analyst**
- **Labeled data**
- **Scoring CSV**

## Connections

- Analyst → Holdout training: runs (evidence: `README.md`)
- Labeled data → Holdout training: loads (evidence: `README.md`)
- Holdout training → Fold pipeline: builds fold (evidence: `src/train.py`)
- Holdout training → Metrics and threshold: formats metrics (evidence: `src/train.py`)
- Holdout training → Saved artifacts: saves models (evidence: `src/train.py`)
- Holdout training → Experiment results: writes holdout (evidence: `src/train.py`)
- Analyst → Cross-validation: runs (evidence: `README.md`)
- Labeled data → Cross-validation: loads (evidence: `src/cross_validate.py`)
- Cross-validation → Fold pipeline: builds folds (evidence: `src/cross_validate.py`)
- Cross-validation → Experiment results: writes summaries (evidence: `src/cross_validate.py`)
- Analyst → Baseline comparison: runs (evidence: `README.md`)
- Labeled data → Baseline comparison: loads (evidence: `src/baselines.py`)
- Baseline comparison → Data cleaning: fits cleaner (evidence: `src/baselines.py`)
- Baseline comparison → ANOVA selection: selects features (evidence: `src/baselines.py`)
- Baseline comparison → Model training: fits baselines (evidence: `src/baselines.py`)
- Baseline comparison → Metrics and threshold: tunes and scores (evidence: `src/baselines.py`)
- Baseline comparison → Experiment results: writes comparison (evidence: `src/baselines.py`)
- Fold pipeline → Data cleaning: cleans splits (evidence: `src/pipeline.py`)
- Fold pipeline → ANOVA selection: selects features (evidence: `src/pipeline.py`)
- Fold pipeline → Model training: scales and fits (evidence: `src/pipeline.py`)
- Fold pipeline → Metrics and threshold: tunes and evaluates (evidence: `src/pipeline.py`)
- Fold pipeline → Settings: reads settings (evidence: `src/pipeline.py`)
- Analyst → Prediction: runs (evidence: `README.md`)
- Scoring CSV → Prediction: loads (evidence: `README.md`)
- Prediction → Saved artifacts: loads artifacts (evidence: `src/predict.py`)
- Prediction → Data cleaning: transforms inputs (evidence: `src/predict.py`)
- Prediction → ANOVA selection: selects columns (evidence: `src/predict.py`)
- Prediction → Model training: gets probabilities (evidence: `src/predict.py`)
- Analyst → Labeled scoring: runs (evidence: `README.md`)
- Scoring CSV → Labeled scoring: loads labeled CSV (evidence: `src/evaluate.py`)
- Labeled scoring → Prediction: prepares features (evidence: `src/evaluate.py`)
- Labeled scoring → Model training: gets probabilities (evidence: `src/evaluate.py`)
- Labeled scoring → Metrics and threshold: computes metrics (evidence: `src/evaluate.py`)
- Analyst → Report figures: runs (evidence: `README.md`)
- Labeled data → Report figures: loads (evidence: `src/make_report_figures.py`)
- Report figures → Fold pipeline: builds fold (evidence: `src/make_report_figures.py`)
