Modular churn modeling pipelines.
Project description
Churn Modeling Pipelines
Churn Modeling Pipelines
A modular, extensible, and production-ready Python package for end-to-end churn prediction and customer analytics. This package supports structured preprocessing, feature engineering, model building, evaluation, visualization, neural networks, ensemble modeling, and exploratory data analysis.
📦 Module Overview
| Module | Description |
|---|---|
ChurnPreprocessor |
Prepares and standardizes raw churn data (e.g., encoding, type fixing, imputations). |
DataPreprocessor |
Utility class for transforming and cleaning structured datasets. |
ChurnModelBuilder |
Builds 5 hyperparameter variants each for Logistic Regression, Decision Tree, KNN, Naive Bayes, SVM, Random Forest, XGBoost, LightGBM, CatBoost, and Keras Neural Networks. |
ChurnEvaluator |
Computes evaluation metrics (Accuracy, Precision, Recall, F1, Cost), and supports confusion matrix, ROC, and model comparison. |
ChurnPlotter |
Visualizes performance results, including composite scores, cost sensitivity, and radar charts for base and ensemble models. |
ModelComparator |
Compares all models across cost, recall, and composite score to select best-performing variants. |
EnsembleBuilder |
Builds ensemble models (Voting, Stacking, Bagging, Boosting, Blending, etc.) with 5 tuned variants per type. |
CustomerJourneyClassifier |
Segments users based on tenure, support interactions, and satisfaction into customer journey stages. |
EDAHelper |
Unified EDA interface that wraps profiling, visualization, and hypothesis testing. |
EDAReports |
Provides data profiling reports (missing values, types, summaries). |
EDAPlots |
Generates univariate, bivariate, and multivariate plots with annotations. |
ChurnHypothesisTester |
Performs statistical tests to validate churn-related hypotheses. |
utils.set_random_seed() |
Ensures reproducibility across NumPy, Python, and hash seed environments. |
build_and_evaluate_neural_net() |
Wrapper to build and evaluate Keras neural networks using Scikit-Learn integration. |
🚀 Quick Start
import pandas as pd
from churn_modeling_pipelines import (
ChurnPreprocessor,
DataPreprocessor,
ChurnModelBuilder,
ChurnEvaluator,
ChurnPlotter,
EnsembleBuilder,
ModelComparator,
CustomerJourneyClassifier,
EDAHelper,
build_and_evaluate_neural_net,
set_random_seed
)
# Load your dataset
df = pd.read_csv("customer_data.csv")
# Step 1: Preprocess
pre = ChurnPreprocessor(df)
processed_df = pre.full_pipeline()
# Step 2: Explore (EDA)
eda = EDAHelper(processed_df)
eda.reports.data_profile()
eda.plots.univariate_numeric("RevPerMonth")
eda.hypothesis.test_churn_hypotheses_stats()
# Step 3: Train/Test Split
from sklearn.model_selection import train_test_split
X = processed_df.drop("Churn", axis=1)
y = processed_df["Churn"]
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, stratify=y)
# Step 4: Set Seed
set_random_seed(42)
# Step 5: Traditional Model Building
builder = ChurnModelBuilder(X_train, X_test, y_train)
svm_models = builder.build_svm()
# Step 6: Evaluation
evaluator = ChurnEvaluator()
results = evaluator.evaluate_models(svm_models, X_test, y_test)
# Step 7: Plotting
plotter = ChurnPlotter()
plotter.plot_model_comparison(results)
# Step 8: Ensemble Models
ensemble = EnsembleBuilder(X_train, X_test, y_train)
voting_models = ensemble.build_voting()
# Step 9: Neural Network Evaluation (New!)
nn_results, nn_variants = build_and_evaluate_neural_net(X_train, X_test, y_train, y_test)
# Step 10: Compare All
comparator = ModelComparator()
summary = comparator.generate_model_summary(results + nn_results + voting_models)
!pip install churn-modeling-pipelines
🧠 Requirements
Python 3.8 or higher
pandas
numpy
matplotlib
seaborn
scikit-learn
xgboost
lightgbm
catboost
scipy
🪪 License
MIT License © 2025
Developed and maintained by John Ebikake
💬 Contact
For issues, suggestions, or contributions:
GitHub: github.com/Ebikake/churn-modeling-pipelines
Email: ebikakejay@gmail.com
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file churn_modeling_pipelines-0.2.26-py3-none-any.whl.
File metadata
- Download URL: churn_modeling_pipelines-0.2.26-py3-none-any.whl
- Upload date:
- Size: 38.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.14.0b4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
71971e9b52f1d4d1ad7decfc2d86bb53c9ba82b3269b31e98e3a06cc715b63fb
|
|
| MD5 |
79d181946eca955270861d9c46d0eac1
|
|
| BLAKE2b-256 |
07fb76ec614fcee8f8d8876627e16a0d804f6f2061c01ad797e6efed16ae9166
|