10 years of DS thinking,
one post at a time

Technical ideas from real projects, not tutorials, not theory. Each post reflects a decision made under real constraints.

B
Decision Systems · Healthcare · Optimization

A predictive model is not a decision system

In a Nairobi ambulance deployment competition, the model predicted crash probability per road segment. But the real decision was: where should 6 ambulances be positioned right now?

The important part was the translation layer between prediction and action: predict risk → select highest-risk segments → cluster into geographic groups → place ambulances at centroids.

Result: In real-world ML, prediction quality and decision quality are related, but they are not the same thing.

B
Feature Engineering · Classification

Turning One Categorical Variable into Behavioral Signal

Some categorical variables are informative but too coarse in raw form. Job_type mixes several underlying dimensions: how income is generated, how often it arrives, and how savings are managed.

I decomposed it into multiple behavioral features: income source, savings pattern, income frequency. Each derived feature captures a different financial mechanism.

Result: The variable is no longer a flat category — it becomes a behavioral representation layer separating latent mechanisms.

B
Forecasting · Routing · Multi-Entity

The hardest forecasting decision is not which model to use!

In a multi-entity time series problem, I spent more time on routing than on model tuning. The series were too heterogeneous: some decelerating, some accelerating, some near-zero, some ambiguous.

Before fitting anything, I built a classification layer: compute elasticity score, classify each entity into a trajectory regime, route to a different forecasting strategy per regime.

Result: When you have many entities to forecast, don't just build a better model. Build a better routing system.

C
Feature Engineering · Encoding · Tabular ML

Encoding is a modeling decision, not a preprocessing checkbox

I encoded six categorical variables differently based on what they represented: Helmert Sequential for day_of_week, Polynomial Ordered for hardware generations, WoE for binary splits, Target encoding for high cardinality.

Every encoding imposes an assumption. Better tabular modeling often starts with representing variables in ways that reflect their actual structure.

Result: Encoding is not preprocessing — it is part of how the model is allowed to interpret the variable.

B
Clustering · Graph Analytics · Telecom

Detecting households is not the same as detecting communities!

Started from precomputed communication communities (SAS CLA results). A communication community is not necessarily a household — it can contain extended family, multiple households, and close friends.

Combined two signals: ranked communication intensity (top contacts weighted by position) and shared dominant evening cell-tower usage. Same community + top-ranked contact + shared evening tower = household tie.

Result: In applied graph analytics, the first cluster is often not the real unit you care about.

C
Analytics · NCA · VC · Survey

Not every analytics question is about what drives the outcome

Most data science asks "what increases Y?" — leading to correlation, regression, SHAP. But some questions are different: what must already be true for high Y to even be possible?

Used Necessary Condition Analysis (NCA) to identify variables that act as minimum requirements, not average drivers. Below a threshold, the outcome simply does not appear.

Result: Some variables are not drivers — they are constraints. "Invest in X to boost" ≠ "guarantee X above threshold before anything else matters."

C
Label Engineering · VC · Survival

The most dangerous label in ML is the one that looks correct but isn't!

In a startup survival project (~50K funding rounds), the label "did not raise again" breaks if the company hasn't been observable for the full 36-month horizon. A startup founded in 2019, observed at 2021, looks like failure but simply hasn't had enough time.

Made two design decisions: eligibility window (only train on 36+ months observable history) and asymmetric holdout (mirror deployment prevalence, not balanced 50/50).

Result: Label design is often more important than algorithm choice. Once temporal contamination enters training, the model learns recency instead of risk.

C
Behavioral Signals · Telecom · Proxy Features

Cell tower dominance is not just a demographic feature

In a telecom family-detection project, I needed to distinguish household-level ties from broader social communities. Added shared dominant cell-tower usage — "which cell tower shows up most in your evening CDR?" People spend ~8 hours a night in the same place.

Infrastructure data became behavioral evidence. The richest signals often hide in operational data, not in declared information.

Result: Cell tower dominance acts as a strong proxy for home location — operational traces as features.

B
Forecasting · Uncertainty · Telecom

Conformal Prediction: when the model is uncertain, the interval tells you

Built an XGBoost model to predict hourly telecom data usage. Standard confidence intervals treated all predictions the same way — but peak hours had much larger errors. The business was making decisions based on false confidence.

Wrapped the model with conformal prediction: a distribution-free uncertainty quantification method. The interval width adapts to the data — wider in peak hours, narrower in off-peak.

Result: Point predictions without uncertainty are incomplete. The interval is the signal that tells you when to trust the forecast.

Share on LinkedIn → View on GitHub →
Insights, Mahmoud Trigui

10 years of DS thinking,
one post at a time

Technical ideas from real projects, not tutorials, not theory. Each post reflects a decision made under real constraints.

A
Feature Engineering

The feature that improved the model most wasn't in the data, it was built from three columns and a business rule

In restaurant rating prediction, a single engineered feature combining order frequency, recency, and menu diversity outperformed 40 raw features. Feature engineering is where domain knowledge becomes model performance.

The raw data had everything: order counts, timestamps, menu items, customer IDs. But none of those columns alone captured what actually drives a restaurant's rating.

The business rule was simple: a restaurant that gets repeat customers, recently, across different menu items, is doing something right. Encoding that logic into a single feature gave the model something it couldn't learn from the raw columns.

Result: One engineered feature outperformed 40 raw features in isolation.

B+
Forecasting · Production

Dead series should be detected before modeling, not learned by the model

In a multi-ID weekly forecasting pipeline, IDs with 26+ consecutive zeros were routed out before training. Letting the model learn zero behavior wastes capacity and distorts the loss for active series.

The model was trying to learn two completely different behaviors at once: active series with real signal, and dead series with structural zeros. The loss function couldn't distinguish between them.

The fix was a pre-processing routing step: detect dead IDs by consecutive zero count, route them to a zero-forecast rule, and train the model only on active series.

Result: Routing dead series out before training improved forecast accuracy on active series and reduced training time.

B+
NLP · Customer Support

Predicting support escalation before it happens requires features the agent never types

In IEEE customer support escalation prediction, the strongest signals were structural: response latency, ticket re-opening rate, message length progression, not the sentiment of the text itself.

The intuition was that escalation is a behavioral pattern, not a linguistic one. An angry customer doesn't always write angry words. But they do reopen tickets, send longer messages over time, and wait longer between responses.

Structural features captured the shape of the interaction, not what was said, but how the conversation evolved over time.

Result: Structural features outperformed raw text sentiment by a wide margin. The model predicted escalation before the customer explicitly expressed frustration.

Follow on LinkedIn → View on GitHub →