How computerscistudent/customer-churn-prediction works
This is a customer-churn prediction application: training data is ingested and split, feature-engineered, used to train and compare models, and then served through FastAPI for prediction and SHAP explanations. The graph includes the documented API and model capabilities plus an internal preprocessing layer. Edges are limited to relationships shown in the README or sampled source; training, evaluation, and UI template wiring beyond those excerpts is not inferred.
Main entry points: main.py FastAPI routes · predict_with_shap.py Prediction and SHAP · artifacts Model artifacts · build_features.py Feature engineering
Components 17
Data preparation
- Telco source data
data/raw/telco.csv - Data ingestion
src/data/data_ingestion.py - Train and test data
data/processed - Feature engineering
src/features/build_features.py
Model lifecycle
- Model training
src/models/train_model_advance.py - Model artifacts
artifacts - Model evaluation
src/models/evaluate.py - Advanced evaluation
src/models/eval_advanced.py - Baseline predictor
src/models/predict_pipeline.py - Prediction and SHAP
src/models/predict_with_shap.py
Prediction API
- FastAPI routes
src/api/main.py - Request schemas
src/api/schema.py - Predictor dependency
src/api/dependences.py - HTML templates
templates
Shared internals
- Logging
src/logger.py - Error handling
src/exception.py
Other components
- API client
Connections 24
- API client → FastAPI routes: submits request
README.md - FastAPI routes → Request schemas: validates with
src/api/main.py - FastAPI routes → Predictor dependency: resolves predictor
src/api/main.py - Predictor dependency → Prediction and SHAP: loads instance
src/api/dependences.py - FastAPI routes → Prediction and SHAP: requests prediction
src/api/main.py - FastAPI routes → Prediction and SHAP: requests explanation
src/api/main.py - Prediction and SHAP → Feature engineering: builds features
src/models/predict_with_shap.py - FastAPI routes → HTML templates: renders pages
src/api/main.py - Telco source data → Data ingestion: reads data
src/data/data_ingestion.py - Data ingestion → Train and test data: writes splits
src/data/data_ingestion.py - Model training → Train and test data: reads training data
src/models/train_model_advance.py - Model training → Feature engineering: builds features
src/models/train_model_advance.py - Model training → Model artifacts: saves models
src/models/train_model_advance.py - Prediction and SHAP → Model artifacts: loads best model
- Baseline predictor → Model artifacts: loads baseline model
- Model evaluation → Train and test data: reads test data
src/models/evaluate.py - Model evaluation → Model artifacts: loads baseline model
src/models/evaluate.py - Advanced evaluation → Train and test data: reads test data
src/models/eval_advanced.py - Advanced evaluation → Feature engineering: builds features
src/models/eval_advanced.py - Advanced evaluation → Model artifacts: loads best model
src/models/eval_advanced.py - Data ingestion → Logging: logs activity
src/data/data_ingestion.py - Feature engineering → Error handling: raises on failure
src/features/build_features.py - Prediction and SHAP → Error handling: raises on failure
src/models/predict_with_shap.py - Error handling → Logging: logs errors
src/exception.py