---
title: Forecasting models that moved real
numbers
subtitle: Demand and supply-chain forecasting,
plus fraud detection, for retail,
manufacturing and financial clients
slug: fraud-and-demand-forecasting
hook: Up to 22% lower inventory holding costs
and ~18% fewer fraud incidents for
retail and financial clients, plus ~15%
better warehouse throughput for a
leading US beverage manufacturer.
role: Senior Data Scientist
employer: Royal Cyber Inc. (Lahore)
client: Retail and financial clients; a
leading US beverage manufacturer
period: Dec 2022 – May 2024
tracks:
- data-science
- mlops
tags:
- fraud detection
- anomaly detection
- demand forecasting
- time series
- imbalanced classification
- CI/CD
- Azure
- Databricks
metrics:
- value: up to 22%
label: Lower inventory holding costs
when: Dec 2022 – May 2024
- value: ~15%
label: Better warehouse throughput and
supply-chain efficiency for a leading
US
beverage manufacturer
when: Dec 2022 – May 2024
- value: ~18%
label: Fewer fraud incidents for retail
and financial clients
when: Dec 2022 – May 2024
---
## Context
Royal Cyber is a consultancy. From December
2022 to May 2024 I was a senior data
scientist on its client projects in
retail, finance, supply chain and
manufacturing. Two kinds of problem kept
coming back:
1. **Catch the bad transaction** before it
costs money.
2. **Have the right stock in the right
place**, without paying to store what
nobody buys.
## The problem
**Fraud** is a rare-event problem. Fraud is a
small fraction of transactions, so a model
can be almost perfectly accurate and still
useless. False negatives cost money. False
positives cost reviewers' time and annoy
good customers.
**Demand** is a trade-off. Forecast too low
and shelves go empty. Forecast too high
and money sits in warehouses as inventory
holding costs. For a leading US beverage
manufacturer, forecasts also had to drive
warehouse operations and the wider
supply-chain and production processes.
## Constraints
- **Imbalanced labels** for fraud: few
positives, noisy definitions.
- **Seasonality and calendar effects** for
demand.
- **Production on the client's stack:**
Microsoft Azure and Databricks, shipped
through CI/CD, not a notebook handed over
by email.
- **Business users had to trust the output**
enough to change what they ordered and
what they reviewed.
## What I built
**Fraud and anomaly detection** for retail and
financial clients: supervised models on
transaction and behavior features, with
class-imbalance handling, plus anomaly
signals for patterns the labels didn't
cover. Models were tuned with Optuna.
**Demand forecasting** with time-series and
regression models. For the beverage
manufacturer, forecasts fed warehouse
operations and supply-chain planning, and
the models were deployed through CI/CD
pipelines on Microsoft Azure and
Databricks.
**The same toolkit, on neighboring problems:**
spot-price prediction from historical
data, real-time bid optimization for
dynamic pricing (deep learning plus time
series), and floor-space optimization for
a manufacturing plant using mathematical
optimization.
## How it fits together
Two problems, one pipeline.
Client data (sales, inventory, transactions)
lands in Databricks, where feature
pipelines build two kinds of features:
calendar, lag and rolling statistics for
demand, and transaction and behavior
patterns for fraud. Models are trained and
tuned, then validated with time-based
splits, because shuffling time series
flatters every model. Only a model that
beats its baseline in backtests moves on.
CI/CD on Azure ships it. Forecasts flow into
inventory and warehouse planning. Fraud
scores flow into a review queue.
Monitoring watches both and triggers
retraining.
## Stack
- **Modeling:** Python, pandas, NumPy,
scikit-learn, XGBoost, TensorFlow and
Keras, Optuna. Time-series and regression
models, classification with
class-imbalance handling, anomaly
detection, mathematical optimization.
- **Platform:** Databricks, Microsoft Azure
(Azure Machine Learning, Azure Functions,
Azure Kubernetes Service), CI/CD
pipelines.
- **Data:** SQL, PostgreSQL, MySQL.
## Results
- **~18% fewer fraud incidents** for retail
and financial clients.
- **Up to 22% lower inventory holding costs.**
- **~15% better warehouse throughput and
supply-chain efficiency** for a leading US
beverage manufacturer.
- **Star Performer of the Year 2023** at Royal
Cyber.
The "~" and "up to" are deliberate. These are
the figures as recorded at the time; the
baselines behind them are the clients'.
## What I'd do differently
- **Put the naive baseline on the dashboard,
forever.** Seasonal-naive for demand,
simple rules for fraud. A ~15% gain means
something only next to what "doing nothing
clever" achieves, and the client should
see that comparison, not just me.
- **Go global earlier.** One gradient-boosted
model across all products, with
rolling-origin backtests, usually beats
many small per-product models and is far
easier to maintain. In 2026 that's my
default starting point.
- **Ship drift monitoring with v1.** Drift
reports and retraining triggers agreed
with the client up front, instead of added
after the first surprise.
- **Price the fraud threshold with finance.**
The right cut-off is a cost trade-off
between losses and reviewer hours. That's
a conversation with the client's finance
team, not a default of 0.5.
## What I left out
This is client work under NDA. Not included,
on purpose:
- client names, beyond the industries;
- data, features specific to client systems,
and model internals;
- how each percentage was measured: the
baselines are client-internal;
- dashboards and reports.
## How to verify
- **LinkedIn projects under Royal Cyber** (Dec
2022 – May 2024): "Fraud and anomaly
detection for retail and finance" (~18%
and up to 22%) and "Supply-chain demand
forecasting" (~15%).
- **A public LinkedIn post from June 2024**,
written when I left Royal Cyber, describes
the supply-chain forecasting with
time-series and regression models and the
CI/CD deployment on Azure and Databricks.
- **LinkedIn honors:** Star Performer of the
Year 2023, Royal Cyber.
- **Employment check:** Royal Cyber Inc.,
Senior Data Scientist, Dec 2022 – May
2024.
- **In an interview:** a walk-through of the
method, within NDA limits.
- **Code:** walkthroughs available on request.
Case study 07 · Royal Cyber Inc. · Dec 2022 – May 2024
Forecasting models that moved real numbers
Demand and supply-chain forecasting, plus fraud detection, for retail, manufacturing and financial clients
Up to 22% lower inventory holding costs and ~18% fewer fraud incidents for retail and financial clients, plus ~15% better warehouse throughput for a leading US beverage manufacturer.
✓ Compiled from this page's own markdown.
Context
Royal Cyber is a consultancy. From December 2022 to May 2024 I was a senior data scientist on its client projects in retail, finance, supply chain and manufacturing. Two kinds of problem kept coming back:
- Catch the bad transaction before it costs money.
- Have the right stock in the right place, without paying to store what nobody buys.
The problem
Fraud is a rare-event problem. Fraud is a small fraction of transactions, so a model can be almost perfectly accurate and still useless. False negatives cost money. False positives cost reviewers' time and annoy good customers.
Demand is a trade-off. Forecast too low and shelves go empty. Forecast too high and money sits in warehouses as inventory holding costs. For a leading US beverage manufacturer, forecasts also had to drive warehouse operations and the wider supply-chain and production processes.
Constraints
- Imbalanced labels for fraud: few positives, noisy definitions.
- Seasonality and calendar effects for demand.
- Production on the client's stack: Microsoft Azure and Databricks, shipped through CI/CD, not a notebook handed over by email.
- Business users had to trust the output enough to change what they ordered and what they reviewed.
What I built
Fraud and anomaly detection for retail and financial clients: supervised models on transaction and behavior features, with class-imbalance handling, plus anomaly signals for patterns the labels didn't cover. Models were tuned with Optuna.
Demand forecasting with time-series and regression models. For the beverage manufacturer, forecasts fed warehouse operations and supply-chain planning, and the models were deployed through CI/CD pipelines on Microsoft Azure and Databricks.
The same toolkit, on neighboring problems: spot-price prediction from historical data, real-time bid optimization for dynamic pricing (deep learning plus time series), and floor-space optimization for a manufacturing plant using mathematical optimization.
How it fits together
Two problems, one pipeline.
Client data (sales, inventory, transactions) lands in Databricks, where feature pipelines build two kinds of features: calendar, lag and rolling statistics for demand, and transaction and behavior patterns for fraud. Models are trained and tuned, then validated with time-based splits, because shuffling time series flatters every model. Only a model that beats its baseline in backtests moves on.
CI/CD on Azure ships it. Forecasts flow into inventory and warehouse planning. Fraud scores flow into a review queue. Monitoring watches both and triggers retraining.
Stack
- Modeling: Python, pandas, NumPy, scikit-learn, XGBoost, TensorFlow and Keras, Optuna. Time-series and regression models, classification with class-imbalance handling, anomaly detection, mathematical optimization.
- Platform: Databricks, Microsoft Azure (Azure Machine Learning, Azure Functions, Azure Kubernetes Service), CI/CD pipelines.
- Data: SQL, PostgreSQL, MySQL.
Results
- ~18% fewer fraud incidents for retail and financial clients.
- Up to 22% lower inventory holding costs.
- ~15% better warehouse throughput and supply-chain efficiency for a leading US beverage manufacturer.
- Star Performer of the Year 2023 at Royal Cyber.
The "~" and "up to" are deliberate. These are the figures as recorded at the time; the baselines behind them are the clients'.
What I'd do differently
- Put the naive baseline on the dashboard, forever. Seasonal-naive for demand, simple rules for fraud. A ~15% gain means something only next to what "doing nothing clever" achieves, and the client should see that comparison, not just me.
- Go global earlier. One gradient-boosted model across all products, with rolling-origin backtests, usually beats many small per-product models and is far easier to maintain. In 2026 that's my default starting point.
- Ship drift monitoring with v1. Drift reports and retraining triggers agreed with the client up front, instead of added after the first surprise.
- Price the fraud threshold with finance. The right cut-off is a cost trade-off between losses and reviewer hours. That's a conversation with the client's finance team, not a default of 0.5.
What I left out
This is client work under NDA. Not included, on purpose:
- client names, beyond the industries;
- data, features specific to client systems, and model internals;
- how each percentage was measured: the baselines are client-internal;
- dashboards and reports.
How to verify
- LinkedIn projects under Royal Cyber (Dec 2022 – May 2024): "Fraud and anomaly detection for retail and finance" (~18% and up to 22%) and "Supply-chain demand forecasting" (~15%).
- A public LinkedIn post from June 2024, written when I left Royal Cyber, describes the supply-chain forecasting with time-series and regression models and the CI/CD deployment on Azure and Databricks.
- LinkedIn honors: Star Performer of the Year 2023, Royal Cyber.
- Employment check: Royal Cyber Inc., Senior Data Scientist, Dec 2022 – May 2024.
- In an interview: a walk-through of the method, within NDA limits.
- Code: walkthroughs available on request.