# shikhar24singh/employee-attrition-prediction-dashboard architecture

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

- Interactive diagram: https://gitdiagram.com/shikhar24singh/employee-attrition-prediction-dashboard
- Repository: https://github.com/shikhar24singh/employee-attrition-prediction-dashboard

## Overview

This is an employee-attrition prediction dashboard backed by a Random Forest pipeline. The main workflow lets an HR user select a held-out employee, adjust overtime and income, and view an updated attrition probability and profile; a separate insights tab shows a confusion matrix and feature drivers. Offline, training loads and splits the source data, preprocesses features, applies SMOTE, and saves the model and test data; evaluation reports metrics and generates the matrix. The graph follows the shown calls and documented capabilities; unsampled runtime details are not inferred.

Main entry points: [`models`](https://github.com/shikhar24singh/employee-attrition-prediction-dashboard/tree/main/models) (Model and plots), [`src/train.py`](https://github.com/shikhar24singh/employee-attrition-prediction-dashboard/blob/main/src/train.py) (Training pipeline), [`app.py`](https://github.com/shikhar24singh/employee-attrition-prediction-dashboard/blob/main/app.py) (Streamlit dashboard), [`src/evaluate.py`](https://github.com/shikhar24singh/employee-attrition-prediction-dashboard/blob/main/src/evaluate.py) (Model evaluation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["HR dashboard"]
  node_dashboard_app["Streamlit dashboard<br/>[app.py]"]
  node_simulator["Employee simulator<br/>[app.py]"]
  node_risk_view["Risk and profile view<br/>[app.py]"]
  node_insights_view["Model insights<br/>[app.py]"]
end

subgraph group_training["Model training"]
  node_preprocess["Feature preprocessing<br/>[preprocess.py]"]
  node_train["Training pipeline<br/>[train.py]"]
end

subgraph group_evaluation["Model evaluation"]
  node_evaluate["Model evaluation<br/>[evaluate.py]"]
end

subgraph group_data["Data and artifacts"]
  node_source_data["HR analytics CSV<br/>[HR_Analytics.csv]"]
  node_test_data["Held-out test data"]
  node_model_artifacts[("Model and plots")]
end

node_hr_user(("HR manager"))

node_hr_user -->|"uses"| node_dashboard_app
node_dashboard_app -->|"shows"| node_simulator
node_simulator -->|"loads sample"| node_test_data
node_simulator -->|"updates inputs"| node_risk_view
node_dashboard_app -->|"loads model"| node_model_artifacts
node_risk_view -->|"predicts with"| node_model_artifacts
node_dashboard_app -->|"shows insights"| node_insights_view
node_insights_view -->|"reads matrix"| node_model_artifacts
node_insights_view -->|"extracts importance"| node_model_artifacts
node_train -->|"loads and splits"| node_source_data
node_train -->|"builds pipeline"| node_preprocess
node_train -->|"saves model"| node_model_artifacts
node_train -->|"saves split"| node_test_data
node_evaluate -->|"loads model"| node_model_artifacts
node_evaluate -->|"loads test data"| node_test_data
node_evaluate -->|"saves matrix"| node_model_artifacts

click node_dashboard_app "https://github.com/shikhar24singh/employee-attrition-prediction-dashboard/blob/main/app.py"
click node_simulator "https://github.com/shikhar24singh/employee-attrition-prediction-dashboard/blob/main/app.py"
click node_risk_view "https://github.com/shikhar24singh/employee-attrition-prediction-dashboard/blob/main/app.py"
click node_insights_view "https://github.com/shikhar24singh/employee-attrition-prediction-dashboard/blob/main/app.py"
click node_preprocess "https://github.com/shikhar24singh/employee-attrition-prediction-dashboard/blob/main/src/preprocess.py"
click node_train "https://github.com/shikhar24singh/employee-attrition-prediction-dashboard/blob/main/src/train.py"
click node_evaluate "https://github.com/shikhar24singh/employee-attrition-prediction-dashboard/blob/main/src/evaluate.py"
click node_source_data "https://github.com/shikhar24singh/employee-attrition-prediction-dashboard/blob/main/data/HR_Analytics.csv"
click node_test_data "https://github.com/shikhar24singh/employee-attrition-prediction-dashboard/tree/main/data"
click node_model_artifacts "https://github.com/shikhar24singh/employee-attrition-prediction-dashboard/tree/main/models"

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_dashboard_app,node_simulator,node_risk_view,node_insights_view toneBlue
class node_preprocess,node_train toneAmber
class node_evaluate toneMint
class node_source_data,node_test_data,node_model_artifacts toneRose
class node_hr_user toneIndigo
```

## Components

### HR dashboard

- [Streamlit dashboard](https://github.com/shikhar24singh/employee-attrition-prediction-dashboard/blob/main/app.py): `app.py`
- [Employee simulator](https://github.com/shikhar24singh/employee-attrition-prediction-dashboard/blob/main/app.py): `app.py`
- [Risk and profile view](https://github.com/shikhar24singh/employee-attrition-prediction-dashboard/blob/main/app.py): `app.py`
- [Model insights](https://github.com/shikhar24singh/employee-attrition-prediction-dashboard/blob/main/app.py): `app.py`

### Model training

- [Feature preprocessing](https://github.com/shikhar24singh/employee-attrition-prediction-dashboard/blob/main/src/preprocess.py): `src/preprocess.py`
- [Training pipeline](https://github.com/shikhar24singh/employee-attrition-prediction-dashboard/blob/main/src/train.py): `src/train.py`

### Model evaluation

- [Model evaluation](https://github.com/shikhar24singh/employee-attrition-prediction-dashboard/blob/main/src/evaluate.py): `src/evaluate.py`

### Data and artifacts

- [HR analytics CSV](https://github.com/shikhar24singh/employee-attrition-prediction-dashboard/blob/main/data/HR_Analytics.csv): `data/HR_Analytics.csv`
- [Held-out test data](https://github.com/shikhar24singh/employee-attrition-prediction-dashboard/tree/main/data): `data`
- [Model and plots](https://github.com/shikhar24singh/employee-attrition-prediction-dashboard/tree/main/models): `models`

### Other components

- **HR manager**

## Connections

- HR manager → Streamlit dashboard: uses (evidence: `README.md`)
- Streamlit dashboard → Employee simulator: shows (evidence: `app.py`)
- Employee simulator → Held-out test data: loads sample (evidence: `app.py`)
- Employee simulator → Risk and profile view: updates inputs (evidence: `app.py`)
- Streamlit dashboard → Model and plots: loads model (evidence: `app.py`)
- Risk and profile view → Model and plots: predicts with (evidence: `app.py`)
- Streamlit dashboard → Model insights: shows insights (evidence: `app.py`)
- Model insights → Model and plots: reads matrix (evidence: `app.py`)
- Model insights → Model and plots: extracts importance (evidence: `app.py`)
- Training pipeline → HR analytics CSV: loads and splits (evidence: `src/train.py`)
- Training pipeline → Feature preprocessing: builds pipeline (evidence: `src/train.py`)
- Training pipeline → Model and plots: saves model (evidence: `src/train.py`)
- Training pipeline → Held-out test data: saves split (evidence: `src/train.py`)
- Model evaluation → Model and plots: loads model (evidence: `src/evaluate.py`)
- Model evaluation → Held-out test data: loads test data (evidence: `src/evaluate.py`)
- Model evaluation → Model and plots: saves matrix (evidence: `src/evaluate.py`)
