chapter eight

8 Building AI fraud detectors: From supervised scoring to anomaly identification

 

This chapter covers

  • Defining principles for AI fraud detection
  • Handling imbalance and privacy in fraud data
  • Training supervised models for known fraud
  • Evaluating fraud models with business metrics
  • Detecting novel anomalies without labels

In chapter 7, we established the theoretical and architectural foundations of financial fraud detection. Now, we transition from concept to code, constructing the actual machine learning (ML) models that operate within the modeling layer to unmask illicit activities in financial data streams.

At its core, AI-driven fraud detection is divided into two primary analytical domains: evaluating isolated transactions and analyzing interconnected networks. This chapter focuses entirely on single-transaction detection. We’ll tackle this through two distinct ML tasks: using supervised learning to recognize known fraud patterns, and using unsupervised anomaly detection to flag novel, previously unseen threats. The second domain—unveiling colluding entities through complex network and graph analytics—will be the focus of chapter 9.

8.1 Recognizing the known: The power and nuances of supervised learning in fraud detection

8.1.1 The cornerstone: Acquiring, managing, and wrestling with labeled data

8.1.2 Beyond binary labels: Achieving contextual understanding in fraud classification

8.1.3 Practical realities: The ongoing vigilance in supervised fraud modeling

8.2 Data preparation and initial exploration for supervised modeling

8.2.1 Loading and understanding our dataset: The Kaggle credit card fraud data

8.2.2 Essential preprocessing: Scaling features and splitting the data

8.3 Supervised fraud classification in action: Training and tuning a LightGBM model

8.3.1 Defining the modeling pipeline and hyperparameter search space

8.3.2 Training the model with randomized hyperparameter search

8.3.3 Evaluating the tuned model: Comprehensive metrics on the test set

8.3.4 Strategic insight: Analyzing performance at top-N% prediction thresholds

8.4 Finding the unknown: Unsupervised anomaly detection with autoencoders

8.4.1 Autoencoders: Learning normality to detect deviance

8.4.2 Preparing data for the autoencoder

8.4.3 Building and training the autoencoder model

8.4.4 Calculating and examining reconstruction errors

Summary