Views
No views yet
Predict whether a customer will churn — before it's too late.
customer_churn_pipeline is a machine learning model built to predict customer churn in subscription-based or service businesses. It uses a complete scikit-learn Pipeline that handles preprocessing and classification in a single, production-ready object — making it easy to integrate directly into any Python application..pkl pipeline file, meaning the entire preprocessing and prediction workflow is bundled together. No separate transformation steps needed — just load and predict.| Step | Description |
|---|---|
| Preprocessing | Handles missing values, scales numerical features, and encodes categorical variables |
| Feature Engineering | Prepares structured tabular customer data for model input |
| Classification | Predicts churn probability and binary outcome (Churn / No Churn) |
| Output | Returns a prediction label: 1 (Churn) or 0 (No Churn) |
pip install scikit-learn pandas joblibcustomer_churn_pipeline.pkl from this repository.1import joblib
2import pandas as pd
3
4# Load the pipeline
5pipeline = joblib.load("customer_churn_pipeline.pkl")
6
7# Sample customer data (adjust columns to match your dataset)
8sample = pd.DataFrame([{
9 "tenure": 12,
10 "MonthlyCharges": 65.5,
11 "TotalCharges": 786.0,
12 "Contract": "Month-to-month",
13 "PaymentMethod": "Electronic check",
14 "InternetService": "Fiber optic",
15 "TechSupport": "No",
16 "OnlineSecurity": "No"
17}])
18
19# Predict
20prediction = pipeline.predict(sample)
21print("Churn Prediction:", "Yes" if prediction[0] == 1 else "No")1proba = pipeline.predict_proba(sample)
2print(f"Churn Probability: {proba[0][1] * 100:.2f}%").pkl file. No need to build separate transformers.| File | Description |
|---|---|
customer_churn_pipeline.pkl | The trained and serialized ML pipeline |
README.md | Documentation and usage guide |