Spaces:
Sleeping
Sleeping
Update README.md
Browse files
README.md
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
---
|
2 |
title: DSA Project
|
3 |
-
emoji:
|
4 |
colorFrom: pink
|
5 |
colorTo: purple
|
6 |
-
sdk:
|
7 |
sdk_version: 5.25.2
|
8 |
app_file: app.py
|
9 |
pinned: false
|
@@ -11,3 +11,86 @@ short_description: Customer Churn Analysis and Prediction
|
|
11 |
---
|
12 |
|
13 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
title: DSA Project
|
3 |
+
emoji: π
|
4 |
colorFrom: pink
|
5 |
colorTo: purple
|
6 |
+
sdk: streamlit
|
7 |
sdk_version: 5.25.2
|
8 |
app_file: app.py
|
9 |
pinned: false
|
|
|
11 |
---
|
12 |
|
13 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
14 |
+
|
15 |
+
# Customer Churn Prediction Application
|
16 |
+
|
17 |
+
This application predicts customer churn based on various customer attributes using a machine learning model.
|
18 |
+
|
19 |
+
## Overview
|
20 |
+
|
21 |
+
Customer churn prediction is a critical task for businesses to identify customers who are likely to discontinue using their products or services. This application uses a Random Forest model trained on historical customer data to predict churn likelihood.
|
22 |
+
|
23 |
+
## Features
|
24 |
+
|
25 |
+
- Interactive web interface for making churn predictions
|
26 |
+
- Input validation and error handling
|
27 |
+
- Visualization of model performance through ROC curve
|
28 |
+
- Probability-based risk assessment
|
29 |
+
- Easy-to-use sliders and dropdown menus for data input
|
30 |
+
|
31 |
+
## Installation
|
32 |
+
|
33 |
+
### Prerequisites
|
34 |
+
|
35 |
+
- Python 3.8 or higher
|
36 |
+
- Required packages (see requirements.txt)
|
37 |
+
|
38 |
+
### Setup
|
39 |
+
|
40 |
+
To run this application on your local machine:
|
41 |
+
|
42 |
+
1. Clone this Space
|
43 |
+
2. Install the required packages:
|
44 |
+
```
|
45 |
+
pip install -r requirements.txt
|
46 |
+
```
|
47 |
+
3. Run the application:
|
48 |
+
```
|
49 |
+
streamlit run app.py
|
50 |
+
```
|
51 |
+
|
52 |
+
## Usage
|
53 |
+
|
54 |
+
1. Adjust the sliders and select options to input customer information:
|
55 |
+
- Age
|
56 |
+
- Gender
|
57 |
+
- Tenure (months)
|
58 |
+
- Usage Frequency
|
59 |
+
- Support Calls
|
60 |
+
- Payment Delay
|
61 |
+
- Last Interaction (days ago)
|
62 |
+
- Total Spend
|
63 |
+
- Subscription Type
|
64 |
+
- Contract Length
|
65 |
+
|
66 |
+
2. Click "Predict Churn" to see the prediction results.
|
67 |
+
|
68 |
+
3. The application will display:
|
69 |
+
- Churn prediction (Yes/No)
|
70 |
+
- Churn probability (0.00-1.00)
|
71 |
+
- Risk level (Low/Medium/High)
|
72 |
+
- ROC curve visualization showing model performance
|
73 |
+
|
74 |
+
## Model Information
|
75 |
+
|
76 |
+
The prediction model (`best_model.pkl`) is a trained Random Forest classifier that has been optimized for churn prediction. The model was trained on historical customer data with features including demographic information, usage patterns, and financial metrics.
|
77 |
+
|
78 |
+
## Deployment
|
79 |
+
|
80 |
+
This application can be deployed on Hugging Face Spaces:
|
81 |
+
|
82 |
+
1. Create a new Space on [Hugging Face](https://huggingface.co/spaces)
|
83 |
+
2. Select Streamlit or Gradio as the SDK
|
84 |
+
3. Upload the necessary files:
|
85 |
+
- `app.py` (or `app_gradio.py`)
|
86 |
+
- `best_model.pkl`
|
87 |
+
- `roc_curve_rf_tuned.png`
|
88 |
+
- `requirements.txt`
|
89 |
+
|
90 |
+
## Files Description
|
91 |
+
|
92 |
+
- `app.py`: Streamlit application code
|
93 |
+
- `app_gradio.py`: Gradio application code (alternative interface)
|
94 |
+
- `best_model.pkl`: Trained machine learning model
|
95 |
+
- `roc_curve_rf_tuned.png`: ROC curve visualization of model performance
|
96 |
+
- `requirements.txt`: List of Python dependencies
|