DSA_Project / README.md
saranimje's picture
Update README.md
71b329b verified

A newer version of the Gradio SDK is available: 5.43.1

Upgrade
metadata
title: DSA Project
emoji: πŸ“ˆ
colorFrom: pink
colorTo: purple
sdk: gradio
sdk_version: 5.25.2
app_file: app_gradio.py
pinned: false
short_description: Customer Churn Analysis and Prediction

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference

Customer Churn Prediction Application

This application predicts customer churn based on various customer attributes using a machine learning model.

Overview

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.

Features

  • Interactive web interface for making churn predictions
  • Input validation and error handling
  • Visualization of model performance through ROC curve
  • Probability-based risk assessment
  • Easy-to-use sliders and dropdown menus for data input

Installation

Prerequisites

  • Python 3.8 or higher
  • Required packages (see requirements.txt)

Setup

To run this application on your local machine:

  1. Clone this Space
  2. Install the required packages:
    pip install -r requirements.txt
    
  3. Run the application:
    streamlit run app.py
    

Usage

  1. Adjust the sliders and select options to input customer information:

    • Age
    • Gender
    • Tenure (months)
    • Usage Frequency
    • Support Calls
    • Payment Delay
    • Last Interaction (days ago)
    • Total Spend
    • Subscription Type
    • Contract Length
  2. Click "Predict Churn" to see the prediction results.

  3. The application will display:

    • Churn prediction (Yes/No)
    • Churn probability (0.00-1.00)
    • Risk level (Low/Medium/High)
    • ROC curve visualization showing model performance

Model Information

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.

Deployment

This application can be deployed on Hugging Face Spaces:

  1. Create a new Space on Hugging Face
  2. Select Streamlit or Gradio as the SDK
  3. Upload the necessary files:
    • app.py (or app_gradio.py)
    • best_model.pkl
    • roc_curve_rf_tuned.png
    • requirements.txt

Files Description

  • app.py: Streamlit application code
  • app_gradio.py: Gradio application code (alternative interface)
  • best_model.pkl: Trained machine learning model
  • roc_curve_rf_tuned.png: ROC curve visualization of model performance
  • requirements.txt: List of Python dependencies