Skip to content

Use a classification model to predict customer churn based on a simplified dataset containing age, tenure, and gender.

Notifications You must be signed in to change notification settings

MarwaAli22/Customer-Churn-Prediction

Repository files navigation

📊 Customer Churn Prediction App

📌 Overview

This project is an interactive Streamlit web application that predicts whether a customer will churn or not using a Naive Bayes classification model.
The app allows users to:

  • Review the dataset
  • Adjust input features (Age, Tenure, Gender) via a sidebar
  • See real-time prediction results and probabilities for churn

The machine learning model is trained using customer data and saved for deployment.
With this app, decision-makers can quickly identify customers at risk of leaving and take proactive measures.


📂 Repository Structure


🛠 Project Workflow

1️⃣ Data Preprocessing

  • Loaded customer churn dataset (churn_dataset.xlsx) using Pandas.
  • Checked data quality and handled categorical variables:
    • Converted "Sex" into numeric values (Male = 1, Female = 0).
    • Converted "Churn" target column into numeric values (Yes = 1, No = 0).

2️⃣ Model Training

  • Selected Naive Bayes (GaussianNB) as the classification model.
  • Split the dataset into training and testing sets using train_test_split.
  • Trained the model on customer features (Age, Tenure, Sex) and target (Churn).
  • Evaluated performance using accuracy score and confusion matrix.

3️⃣ Model Saving

  • Saved the trained model using joblib.dump as naivebayesClassifier.pkl for later deployment.

4️⃣ Streamlit App Development

  • Created an interactive Streamlit app to:
    • Display a preview of the dataset.
    • Accept user inputs for Age, Tenure, and Gender via sidebar controls.
    • Convert gender selection to numeric values for prediction.
    • Load the saved Naive Bayes model and make predictions.
    • Display prediction probabilities for both churn and non-churn cases.

About

Use a classification model to predict customer churn based on a simplified dataset containing age, tenure, and gender.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published