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.
- StreamlitApp.py → Main Streamlit application script for deployment.
- churn_dataset.xlsx → Customer churn dataset used for training and prediction.
- lab2(classification).ipynb → Jupyter Notebook containing the full data preprocessing, model training, evaluation, and saving steps.
- naivebayesClassifier.pkl → Pre-trained Naive Bayes model file saved using Joblib.
- requirements.txt → Required Python libraries for running the app.
- 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
).
- Converted
- 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.
- Saved the trained model using
joblib.dump
asnaivebayesClassifier.pkl
for later deployment.
- 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.