File size: 1,416 Bytes
5b21e2e
fbcf676
e2eb1bd
 
 
5b21e2e
 
 
fbcf676
5b21e2e
fbcf676
 
5b21e2e
 
e2eb1bd
 
 
5b21e2e
e2eb1bd
 
5b21e2e
e2eb1bd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
---
title: EmployeeAttritionClassification
emoji: 🏢
colorFrom: indigo
colorTo: blue
sdk: docker
app_port: 8501
tags:
- streamlit
pinned: false
short_description: Employee Attrition Predictor using XGBoost.
license: mit
---

## Overview
This app predicts the **probability of employee attrition (Attrition = 1)** using a trained **XGBoost classifier**.
The model was evaluated using **ROC-AUC** and achieved strong validation performance.

## Files in this repo
Place these files in the **repo root (same folder as `app.py`)**:

- `xgb_model.pkl` — trained XGBoost model
- `feature_names.pkl` — list of training feature columns (order matters)
- `threshold.pkl` — decision threshold (e.g., 0.35)

## How to use the app
### 1) Single prediction (form)
- Enter numeric/ordinal feature values
- Select one option for categorical groups (one-hot)
- The app outputs:
  - `Attrition probability`
  - `Attrition prediction` using your saved threshold

### 2) Batch prediction (CSV upload)
Upload a CSV that is already in the **same feature format** as your training data
(after preprocessing and one-hot encoding).
The app will align columns automatically using `feature_names.pkl`.

## Notes
- Kaggle submissions typically require **probabilities**, not class labels.
- If you want to change the decision threshold, update `threshold.pkl`.

## Local run
```bash
pip install -r requirements.txt
streamlit run app.py