๐Ÿ” Machine Learning ยท Financial Analytics ยท Python

Transaction Anomaly Detector

Unsupervised anomaly detection pipeline on a financial transaction dataset using Isolation Forest โ€” flagging outliers before they reach any downstream report, with a false-positive comparison against a threshold-based baseline.

Isolation
Forest model
โ†“ FP
vs threshold baseline
3
Anomaly signals
Options
Doc included
The Problem

Financial transaction data is noisy. Unusual amounts, odd timing patterns, and unfamiliar counterparty combinations can signal errors, exceptions, or fraud โ€” but they look like normal variation until someone digs in manually.

Threshold-based rules catch the obvious outliers, but they miss the subtle ones and flag too many false positives to be useful. The goal was a smarter approach that could learn what "normal" looks like from the data itself.

The Goal

Build an unsupervised anomaly detection pipeline that flags unusual transactions โ€” before they reach any report โ€” with fewer false positives than a simple threshold rule, and a clear options doc for tuning the sensitivity trade-off.

My Role

Built the full pipeline end to end โ€” SQL extraction, feature engineering on the transaction data, Isolation Forest model training and scoring, false-positive comparison against a threshold-based baseline, and an options document laying out the sensitivity trade-offs for whoever would tune it in production.

Tools & What I Used Them For
Python โ€” Pandas & NumPy Data Prep
Extracted and cleaned the transaction dataset โ€” handled missing values, standardized date and amount fields, engineered features like rolling averages and counterparty frequency that the model could actually use.
Scikit-learn โ€” Isolation Forest Anomaly Detection
Trained an Isolation Forest model on transaction amount, timing patterns, and counterparty signals. Isolation Forest works by isolating outliers rather than profiling normal behavior โ€” well-suited to financial data where anomalies are rare and varied.
SQL Extraction
Pulled transaction data from the source database using SQL โ€” joining transaction records with counterparty and account metadata, filtering to the relevant date range, and structuring for feature engineering.
Threshold Baseline Comparison Evaluation
Built a simple rule-based baseline (flag anything beyond N standard deviations) and compared its false-positive rate against the Isolation Forest output. The comparison quantified the improvement and guided the sensitivity options doc.
Outcomes
๐Ÿ”
Isolation Forest outperformed the threshold baseline. Fewer false positives while catching the same set of genuine outliers โ€” particularly on subtle timing and counterparty patterns the threshold rule missed.
๐Ÿ“„
Options doc for production tuning. Documented the contamination parameter sensitivity, the false-positive / recall trade-off at different thresholds, and recommendations for each use case โ€” fraud review vs. reconciliation exception flagging.
๐Ÿ”„
Pipeline is reusable. Built as modular Python โ€” the extraction, feature engineering, and scoring steps are separated so the model can be retrained or plugged into a different data source with minimal rework.
โ† Back to Portfolio Next Project โ†’