Anomaly detection on financial data — A classical ML based approach

· Source: Machine Learning on Medium · Field: Technology & Digital — Artificial Intelligence & Machine Learning, Data Science & Analytics, FinTech & Digital Financial Services · Depth: Intermediate, medium

Summary

An unsupervised anomaly detection system, leveraging a classical LSTM encoder-decoder model, was developed to identify anomalous behavior in simulated corporate financial time series data. This system aims to flag deviations from normal patterns early for banking and regulatory systems. The LSTM model, trained exclusively on ordinary historical data, uses prediction error as an anomaly score, effectively identifying unusual data without requiring labeled "bad" examples. Key challenges addressed include managing rare anomalies by capping alerts to investigator capacity, which boosted precision from 12% to 60%. Additionally, robust pre-filtering of streaming input data is crucial to prevent model corruption from incomplete or malformed records. Success is measured by recall and precision, avoiding misleading overall accuracy metrics in rare event scenarios.

Key takeaway

For Data Scientists or MLOps Engineers deploying anomaly detection for financial time series, you must prioritize robust data quality checks and calibrate alert thresholds to human investigative capacity, rather than relying solely on misleading overall accuracy metrics. This strategy, which improved precision from 12% to 60% in experiments, prevents alert fatigue and ensures that the system delivers actionable insights from genuinely rare events.

Key insights

Anomaly detection on time series benefits from models that learn normal patterns and contextual history.

Principles

Method

An LSTM encoder-decoder is trained solely on normal time series data to predict future values; its prediction error then serves as the anomaly score.

In practice

Topics

Code references

Best for: Machine Learning Engineer, Data Scientist, MLOps Engineer

Related on AIssential

Open in AIssential →

Editorial summary, takeaway, and curation by AIssential. Original article published by Machine Learning on Medium.