Artificial Intelligence 11 min read

Building a KPI Alert System with Matrix Profiling and MACD at Tubi

An in‑depth case study describes how Tubi’s data‑science team built a flexible KPI alert system that tackles seasonal trends and diverse metric scales by applying seasonal decomposition, Matrix Profiling via the Stumpy library for anomaly detection, and MACD for trend analysis, achieving higher true‑positive rates while reducing false alarms.

Bitu Technology
Bitu Technology
Bitu Technology
Building a KPI Alert System with Matrix Profiling and MACD at Tubi

Tubi, one of the world’s largest streaming services, needed a robust KPI monitoring solution that could handle seasonal fluctuations, diverse metric types (percentages and absolute counts), and variations across audience segments and platforms.

To address these challenges, the team first split each metric into separate time‑series based on audience‑platform combinations and applied seasonal_decompose from the statsmodels library to remove trend and seasonality, producing cleaner signals for analysis.

For anomaly detection, they adopted the Matrix Profiling (MP) algorithm using the open‑source Stumpy package. MP was chosen for its simplicity, interpretability, low memory footprint, parallelizability, unsupervised nature, and ability to operate on streaming data without a training window.

The implementation involved several steps: (1) preprocessing the series to eliminate trend and seasonality, (2) feeding the cleaned data into three MP variants (original, moving‑block sampling, random‑window sampling) to improve stability, (3) calculating weekly percent‑change, (4) combining the MP score with the percent‑change to produce a final anomaly score, and (5) flagging points that exceed a configurable threshold. Key parameters such as KPI window length, MP window size, and a scaling factor C were tuned to maximize true positives while minimizing false positives.

For trend detection, the team employed the Moving Average Convergence/Divergence (MACD) technique. Two exponential weighted moving averages (EWMA) with different window lengths generate the MACD line; a signal line is derived from a further EWMA of the MACD. The MACD histogram highlights gradual shifts, allowing the system to detect slow, sustained declines that might not trigger sharp anomaly alerts.

Both methods were visualized in dashboards, with examples showing detected anomalies (red dots) and MACD‑based trend signals (green/red markers). The combined approach improved the system’s sensitivity to real issues, increased true‑positive detection rates, and reduced false alarms, providing stakeholders with timely, actionable insights.

Since deployment, the alert system has been running for several weeks, with ongoing enhancements planned. The team expects the solution to become a core component of Tubi’s long‑term health monitoring strategy.

anomaly detectionKPI monitoringtime seriesMACDmatrix profilingstumpy
Bitu Technology
Written by

Bitu Technology

Bitu Technology is the registered company of Tubi's China team. We are engineers passionate about leveraging advanced technology to improve lives, and we hope to use this channel to connect and advance together.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.