My Model Worked Perfectly. Then I Tried to Make It Useful.
The author transitioned from data analytics to data engineering by building two ETL pipelines (GitHub → SQLite via GitHub Actions, RSS → Kestra on hourly schedules) before tackling machine learning A churn prediction model was built for a fictional telecom company (Northline Mobile) using 7,043 customer records, achieving 81% accuracy through cross-validation The core insight: building the model was the easy part; making it usable required exposing it as a service via FastAPI rather than leaving
Analysis
TL;DR
- The author transitioned from data analytics to data engineering by building two ETL pipelines (GitHub → SQLite via GitHub Actions, RSS → Kestra on hourly schedules) before tackling machine learning
- A churn prediction model was built for a fictional telecom company (Northline Mobile) using 7,043 customer records, achieving 81% accuracy through cross-validation
- The core insight: building the model was the easy part; making it usable required exposing it as a service via FastAPI rather than leaving it trapped in a Jupyter notebook
- The API was designed with full-fidelity input (accepting all raw customer fields) and a simplified output schema returning churn_probability, prediction, and a derived risk_level bucket (Low/Medium/High)
- A critical intermediate step is preprocessing: raw JSON input must be transformed into the format the trained model expects before inference can occur
Why It Matters
This article highlights a common gap in AI/ML practice: many practitioners stop at model training without considering production usability, leaving models as notebook artifacts only their builder can operate. It demonstrates the practical shift from "model in a notebook" to "model as a service," a transition essential for any ML system intended to integrate with dashboards, other teams, or downstream applications.
Technical Details
- Model: Churn classifier trained on 7,043 customer records featuring 20 input columns (demographics, contract type, services, charges); achieved 81% accuracy with cross-validation
- Serving layer: FastAPI used to expose the model as an HTTP service, decoupling inference from the development environment
- API design: Full-fidelity input schema accepting all raw customer fields; output deliberately simplified to
churn_probability,prediction(0/1), andrisk_level(Low <0.3, Medium 0.3–0.6, High >0.6) — with the author noting thresholds are heuristic, not statistically derived - Preprocessing pipeline: Raw JSON input must pass through the same cleaning and encoding steps as training data before reaching the model, a step the author identifies as easily underestimated
- Orchestration context: Prior ETL work used GitHub Actions (scheduled) and Kestra (hourly), establishing an infrastructure mindset carried into the ML serving layer
Industry Insight
- The "notebook-to-service" gap is a widespread bottleneck; organizations should prioritize API exposure and schema design as part of the model development lifecycle, not as an afterthought
- Output simplification (e.g., adding human-actionable risk buckets on top of raw probabilities) is a practical pattern for bridging the gap between model outputs and business decision-making, though thresholds should be validated against domain data
- Full-fidelity input schemas improve integration compatibility with existing systems, but require robust preprocessing pipelines — investing in this boundary design early reduces friction during deployment
Disclaimer: The above content is generated by AI and is for reference only.