Chapter 8: Building AI fraud detectors: From supervised scoring to anomaly identification
The introduction scopes this chapter to single-transaction fraud detection, contrasts its two modeling tasks with network analysis, and emphasizes the need to handle fraud-data challenges rigorously.
After this chapter you will be able to
- Fraud Detection Domains and Tasks. Distinguish single-transaction detection from analysis of interconnected networks, and explain that the chapter uses supervised learning for known fraud patterns and unsupervised anomaly detection for novel threats.
- Supervised fraud scoring. Explain how a supervised fraud model learns from reliably labeled historical examples to distinguish fraud from legitimate activity and usually outputs a risk score for real-time decisions.
- Fraud labels as ground truth. Explain why supervised fraud models need reliable fraud-or-legitimate labels and describe where those labels can come from.
- Rare fraud and training remedies. Explain how class imbalance can bias a fraud model toward legitimate transactions, and distinguish resampling from cost-sensitive learning.
- Accuracy and error tradeoffs. Explain why overall accuracy is misleading for rare fraud and distinguish what precision and recall measure and protect against.
- Contextual fraud classification. Explain why an out-of-pattern transaction should not automatically be treated as fraud, and describe how surrounding evidence helps distinguish legitimate travel spending from compromised-card use.
- Explainable fraud model decisions. Explain why financial institutions need to understand individual fraud-model decisions and why opaque, high-performance models may require XAI techniques.
- Fraud model decay. Explain how changing fraud tactics weaken a supervised model trained on historical data and what ongoing response the section calls for.
- Scarce fraud labels. Describe the difficulty of obtaining enough high-quality labels for some fraud types and the auxiliary approaches the section identifies, including their cautions.
- Static dataset versus production data. Distinguish the chapter’s clean, static creditcard.csv dataset from a financial institution’s continuously updated data asset layer. Describe how production data can arrive through streams, near real-time aggregations, and batch updates before reaching feature stores or data marts for modeling.
- Imbalance and scaling implications. Explain why the observed class distribution is a central modeling challenge and identify the preparation concern raised by Amount.
- Scaling mismatched feature ranges. Explain why Amount and Time are standardized relative to the PCA-derived V features, and what StandardScaler does to them. Distinguish this general preprocessing choice from a requirement of LightGBM.
- Stratified fraud evaluation split. Describe how the training and test sets serve different purposes and why the split is stratified by Class. Explain what the reported fraud proportions show about the split.
- Unbiased evaluation safeguards. Explain why the test set remains in its original imbalanced state and why resampling before cross-validation is avoided.
- LightGBM for transaction classification. Explain that the demonstration uses LightGBM to distinguish fraudulent from legitimate transactions because it is efficient and performs strongly on tabular data.
- Fold-local oversampling during tuning. Explain why the pipeline combines oversampling with LightGBM during RandomizedSearchCV: oversampling within each cross-validation fold addresses class imbalance without data leakage and supports better model selection.
- Leakage-safe modeling pipeline. Explain why SMOTE and LightGBM are chained in a pipeline used with RandomizedSearchCV.
- Fraud recall objective. Justify optimizing recall for the fraudulent class in this randomized search.
- Fold-local training and tuning. Trace what happens when .fit() is called on RandomizedSearchCV: it samples 10 hyperparameter combinations, runs 5-fold cross-validation for each, and applies SMOTE to each fold’s training data before fitting LightGBM.
- Best pipeline and refit. Explain how the search identifies the best hyperparameters by cross-validated recall and automatically refits that complete pipeline on the original training set, leaving the unseen, imbalanced test set for subsequent evaluation.
- Untouched test set evaluation. Explain why the tuned fraud model is evaluated on X_test and y_test, which were not used for training, hyperparameter tuning, or SMOTE oversampling.
- Fraud classification evaluation outputs. Describe how the confusion matrix compares predictions with actual labels, identify its four fraud-detection outcomes, and name the other reported measures: precision, recall, AUC, and AUC-PR.
- Top-N% fraud evaluation. Describe how to evaluate the tuned model by sorting test transactions by predicted fraud probability, selecting the highest-risk percentages, and calculating precision and overall fraud capture rate for each segment.
- Review depth tradeoff. Explain how widening the top-N% segment changes alert volume, precision, and fraud capture in the section’s results.
- Operational threshold selection. Explain why the choice of top-N% to act on, and whether to review, block, or request authentication, depends on operational capacity and the costs of false positives and missed fraud.
- Novel fraud and learned normality. Explain why supervised fraud detection may miss novel tactics and how unsupervised anomaly detection addresses that gap by flagging significant departures from normal financial behavior as potential fraud.
- Normal-only training and anomaly scores. Explain why training only on legitimate transactions makes reconstruction error useful as an anomaly score, and what a high score means.
- Normal-only autoencoder training data. Explain why the autoencoder is trained on legitimate transactions and how those transactions are selected from X_train.
- Labels and mixed-set evaluation. Distinguish using labels to select training data from using them as supervised targets, and describe the purpose of the full test set.
- Encoder bottleneck and decoder. Describe how the encoder compresses transaction features into a lower-dimensional bottleneck and the decoder reconstructs them, including how the layer structure supports that process.
- Legitimate data training checks. Explain how legitimate transactions are used to train and validate the autoencoder, and how training progress and architecture are checked.
- Classwise error comparison. Explain what the true-class summary statistics show about fraud and legitimate transactions, and why that comparison supports anomaly-based detection.
- Reconstruction Error Separation. Explain what the reconstruction-error scatter plots show for legitimate and fraudulent transactions, and why that pattern supports using reconstruction error as an anomaly score.
- Unlabeled threshold decision. Explain why a live autoencoder fraud detector needs a reconstruction-error threshold and why that threshold cannot be selected from incoming transactions’ true fraud classes.
- Operational threshold tradeoffs. Explain how review capacity and tolerance for customer friction can shape a reconstruction-error threshold.
- Shadow testing and recalibration. Describe how to validate a proposed threshold safely and why it must be monitored after deployment.
- Real-time scoring flow. Trace a transaction from the API gateway through feature enrichment and model serving to a final approve, review, or decline decision.
- Layered failure fallback. Explain why real-time scoring needs graceful degradation and how the described circuit breaker handles failures of the primary model and its backup.
What it builds on
- Modeling layer: AI techniques for fraud detection (chapter 7) · Introduces AI techniques in the fraud-detection modeling layer.
- The distinctive nature of financial fraud (chapter 7) · Provides earlier context on the distinctive nature of financial fraud.
- Data asset layer for AI-powered fraud detection (chapter 7) · Assumes the data asset layer’s place in fraud detection.
- Model interpretability: From black box to business dialogue (chapter 6) · Earlier discussion of model interpretability and explanations.
- Strategy and monitoring layer: From scores to actionable intelligence (chapter 7) · The strategy and monitoring layer's role in turning fraud scores into action.
- Application layer: Deploying and operationalizing fraud defenses (chapter 7) · The need to deploy and operate fraud defenses.
Section by section
Introduction
The introduction scopes this chapter to single-transaction fraud detection, contrasts its two modeling tasks with network analysis, and emphasizes the need to handle fraud-data challenges rigorously.
- Fraud Detection Domains and Tasks: Distinguish single-transaction detection from analysis of interconnected networks, and explain that the chapter uses supervised learning for known fraud patterns and unsupervised anomaly detection for novel threats.
Why it matters: This distinction keeps the chapter’s transaction-level models separate from the network analysis covered next. - Fraud Data Modeling Challenges: Explain the introduction’s claim that building successful fraud models depends on rigorously handling fraud-data challenges, including extreme class imbalance and adversarial drift.
Why it matters: A model’s usefulness depends on confronting the difficult conditions of fraud data, not just training an algorithm.
Key terms: single-transaction detection, supervised learning, unsupervised anomaly detection, network and graph analytics, extreme class imbalance, adversarial drift, production-ready models
8.1 Recognizing the known: The power and nuances of supervised learning in fraud detection
Introduces supervised fraud detection as learning from labeled historical transactions to produce risk scores for real-time decisions.
- Supervised fraud scoring: Explain how a supervised fraud model learns from reliably labeled historical examples to distinguish fraud from legitimate activity and usually outputs a risk score for real-time decisions.
Why it matters: This connects the need for trustworthy labeled data to the scores used in fraud decisions.
Key terms: supervised learning, labeled experiences, historical data, risk score
8.1.1 The cornerstone: Acquiring, managing, and wrestling with labeled data
This section explains why supervised fraud detection depends on reliable labels, how rare fraud distorts training, and which metrics reveal useful performance.
- Fraud labels as ground truth: Explain why supervised fraud models need reliable fraud-or-legitimate labels and describe where those labels can come from.
Why it matters: A supervised detector can learn only from the quality of the fraud outcomes it is given. - Rare fraud and training remedies: Explain how class imbalance can bias a fraud model toward legitimate transactions, and distinguish resampling from cost-sensitive learning.
Why it matters: These approaches counter the tendency to learn that nearly every transaction is safe. - Accuracy and error tradeoffs: Explain why overall accuracy is misleading for rare fraud and distinguish what precision and recall measure and protect against.
Why it matters: Choosing a metric means deciding how to weigh customer friction against missed fraud losses. - Balanced and threshold-wide metrics: Describe when F1 score is useful and why AUC-PR is preferred to ROC AUC for highly imbalanced fraud data.
Why it matters: These summaries help compare detectors without relying on misleading overall accuracy.
Key terms: labeled data, ground truth, chargeback data, human review teams, class imbalance, resampling, oversampling, undersampling, cost-sensitive learning, accuracy
8.1.2 Beyond binary labels: Achieving contextual understanding in fraud classification
The section explains how supervised fraud detection can use transaction context to distinguish unusual but legitimate spending from fraud, reducing false positives.
- Contextual fraud classification: Explain why an out-of-pattern transaction should not automatically be treated as fraud, and describe how surrounding evidence helps distinguish legitimate travel spending from compromised-card use.
Why it matters: Context can protect genuine customers from unnecessary blocks without ignoring actual fraud. - Contextual data and label requirements: Describe what supports nuanced fraud classification and clarify whether every transaction needs an explicit contextual label.
Why it matters: Context-aware classification depends on useful signals in the data, not merely on adding names for every kind of transaction.
Key terms: binary classification, context-aware understanding, false positives, benign deviations, fraud signals, data asset layer, feature engineering, customer behavior clustering, feedback from human analysts
8.1.3 Practical realities: The ongoing vigilance in supervised fraud modeling
Effective supervised fraud detection requires explainable decisions, vigilance against model decay, and ways to cope with scarce fraud labels.
- Explainable fraud model decisions: Explain why financial institutions need to understand individual fraud-model decisions and why opaque, high-performance models may require XAI techniques.
Why it matters: An alert is more useful when people can understand and justify the decision behind it. - Fraud model decay: Explain how changing fraud tactics weaken a supervised model trained on historical data and what ongoing response the section calls for.
Why it matters: A fraud detector cannot remain reliable merely because it performed well when first trained. - Scarce fraud labels: Describe the difficulty of obtaining enough high-quality labels for some fraud types and the auxiliary approaches the section identifies, including their cautions.
Why it matters: A shortage of confirmed examples can constrain a fraud model even when the modeling method is sound.
Key terms: model interpretability, eXplainable AI (XAI), SHAP, LIME, model decay, concept drift, continuous performance monitoring, retraining, label scarcity, semi-supervised learning
8.2 Data preparation and initial exploration for supervised modeling
This section frames the Kaggle fraud dataset as a simplified snapshot of the dynamic data environment used in production fraud modeling.
- Static dataset versus production data: Distinguish the chapter’s clean, static creditcard.csv dataset from a financial institution’s continuously updated data asset layer. Describe how production data can arrive through streams, near real-time aggregations, and batch updates before reaching feature stores or data marts for modeling.
Why it matters: It helps you keep the chapter’s modeling exercise in perspective when thinking about a live fraud system.
Key terms: Credit Card Fraud Detection dataset, creditcard.csv, data asset layer, feature stores, data marts
8.2.1 Loading and understanding our dataset: The Kaggle credit card fraud data
This section inspects the credit card fraud dataset and identifies anonymized features and severe class imbalance as key considerations for modeling.
- Anonymized transaction features: Explain what the V1–V28 features are and why their anonymization limits exploratory analysis. Identify Time, Amount, and the meaning of the Class label.
Why it matters: It tells you what the model can use and what you cannot infer from the anonymized columns. - Initial dataset inspection: Describe what the first-row preview, df.shape, and value_counts() establish about the loaded dataset.
Why it matters: These basic checks establish the dataset’s structure and expose its target distribution before modeling. - Imbalance and scaling implications: Explain why the observed class distribution is a central modeling challenge and identify the preparation concern raised by Amount.
Why it matters: Recognizing rare fraud and differently scaled inputs guides the next preparation and evaluation choices.
Key terms: PCA, V1 through V28, Time, Amount, Class, target label, df.shape, value_counts(), features, class imbalance
8.2.2 Essential preprocessing: Scaling features and splitting the data
This section prepares an imbalanced fraud dataset for modeling by scaling two features, making a stratified train-test split, and preserving an unbiased test set.
- Scaling mismatched feature ranges: Explain why Amount and Time are standardized relative to the PCA-derived V features, and what StandardScaler does to them. Distinguish this general preprocessing choice from a requirement of LightGBM.
Why it matters: Comparable feature scales can help algorithms sensitive to numerical distances without implying that LightGBM requires scaling. - Stratified fraud evaluation split: Describe how the training and test sets serve different purposes and why the split is stratified by Class. Explain what the reported fraud proportions show about the split.
Why it matters: With fraud so rare, a representative test split makes the performance assessment more meaningful. - Unbiased evaluation safeguards: Explain why the test set remains in its original imbalanced state and why resampling before cross-validation is avoided.
Why it matters: These safeguards prevent a reassuring score from masking poor performance on realistically rare fraud.
Key terms: Amount, Time, V1–V28, StandardScaler, standardization, LightGBM, training set, test set, stratification, Class
8.3 Supervised fraud classification in action: Training and tuning a LightGBM model
Introduces LightGBM as the supervised fraud classifier and explains why oversampling must occur within cross-validation folds during tuning.
- LightGBM for transaction classification: Explain that the demonstration uses LightGBM to distinguish fraudulent from legitimate transactions because it is efficient and performs strongly on tabular data.
Why it matters: The model choice fits the tabular transaction data used in this fraud-detection example. - Fold-local oversampling during tuning: Explain why the pipeline combines oversampling with LightGBM during RandomizedSearchCV: oversampling within each cross-validation fold addresses class imbalance without data leakage and supports better model selection.
Why it matters: Keeping oversampling inside each fold makes the tuning evaluation more trustworthy.
Key terms: LightGBM, supervised learning, tabular datasets, ML pipeline, oversampling, RandomizedSearchCV, cross-validation fold, data leakage, class imbalance
8.3.1 Defining the modeling pipeline and hyperparameter search space
Defines a reproducible SMOTE–LightGBM randomized-search setup for fraud detection, including leakage-safe resampling, a hyperparameter search space, and a recall-focused objective.
- Leakage-safe modeling pipeline: Explain why SMOTE and LightGBM are chained in a pipeline used with RandomizedSearchCV.
Why it matters: Resampling outside the fold’s training data could make the model selection results misleading. - Classifier search space tradeoffs: Describe how the LightGBM search space balances model capacity against overfitting and improves robustness.
Why it matters: The search tests useful model capacity without treating greater complexity as automatically better. - SMOTE balance search: Explain what the two SMOTE search parameters control and why the search includes different class balances.
Why it matters: The amount of oversampling is a choice to test, not a fixed requirement to make the classes equal. - Fraud recall objective: Justify optimizing recall for the fraudulent class in this randomized search.
Why it matters: The search metric should reflect the costly error the fraud detector is meant to avoid.
Key terms: SMOTE, LightGBM, pipeline, RandomizedSearchCV, data leakage, n_estimators, num_leaves, min_child_samples, learning_rate, reg_alpha
8.3.2 Training the model with randomized hyperparameter search
This section runs a randomized search that applies SMOTE within cross-validation folds, selects the pipeline with the best recall, and refits it for later test-set evaluation.
- Fold-local training and tuning: Trace what happens when .fit() is called on RandomizedSearchCV: it samples 10 hyperparameter combinations, runs 5-fold cross-validation for each, and applies SMOTE to each fold’s training data before fitting LightGBM.
Why it matters: Where SMOTE runs determines whether cross-validation gives a trustworthy comparison of the candidate settings. - Best pipeline and refit: Explain how the search identifies the best hyperparameters by cross-validated recall and automatically refits that complete pipeline on the original training set, leaving the unseen, imbalanced test set for subsequent evaluation.
Why it matters: The best cross-validation score selects the pipeline; the untouched test set is reserved for a separate evaluation.
Key terms: RandomizedSearchCV, .fit(), 5-fold cross-validation, SMOTE, LightGBM, cross-validated recall, best_model_final, random_search_final, refits, X_train
8.3.3 Evaluating the tuned model: Comprehensive metrics on the test set
This section evaluates the tuned fraud model on an untouched test set using metrics suited to imbalanced classification.
- Untouched test set evaluation: Explain why the tuned fraud model is evaluated on X_test and y_test, which were not used for training, hyperparameter tuning, or SMOTE oversampling.
Why it matters: The test results are meant to reflect performance on unseen data, not data altered or used while building the model. - Fraud classification evaluation outputs: Describe how the confusion matrix compares predictions with actual labels, identify its four fraud-detection outcomes, and name the other reported measures: precision, recall, AUC, and AUC-PR.
Why it matters: These outputs show both which transaction decisions the model gets wrong and its broader measured performance.
Key terms: test set, X_test, y_test, SMOTE, best_model_final, confusion matrix, true positives, true negatives, false positives, false negatives
8.3.4 Strategic insight: Analyzing performance at top-N% prediction thresholds
This section evaluates a supervised fraud model at different top-N% review depths and uses the precision–fraud-capture tradeoff to guide operational decisions.
- Top-N% fraud evaluation: Describe how to evaluate the tuned model by sorting test transactions by predicted fraud probability, selecting the highest-risk percentages, and calculating precision and overall fraud capture rate for each segment.
Why it matters: This shows what the model delivers at review volumes an operations team could choose. - Review depth tradeoff: Explain how widening the top-N% segment changes alert volume, precision, and fraud capture in the section’s results.
Why it matters: A higher fraud capture rate can require an impractically large volume of mostly false alerts. - Operational threshold selection: Explain why the choice of top-N% to act on, and whether to review, block, or request authentication, depends on operational capacity and the costs of false positives and missed fraud.
Why it matters: The analysis turns model probabilities into a defensible choice about which transactions receive attention and what happens next.
Key terms: top N%, predicted fraud probability, precision, fraud capture rate, recall, Precision@TopN%, Fraud Capture Rate@N%, false positives, review depth, operational threshold
8.4 Finding the unknown: Unsupervised anomaly detection with autoencoders
This section explains why anomaly detection can complement supervised fraud detection by flagging behavior that departs from learned normality.
- Novel fraud and learned normality: Explain why supervised fraud detection may miss novel tactics and how unsupervised anomaly detection addresses that gap by flagging significant departures from normal financial behavior as potential fraud.
Why it matters: It explains why detecting unfamiliar fraud calls for a different approach from recognizing previously labeled attacks.
Key terms: supervised learning, unsupervised learning, anomaly detection, normal financial behavior, potential anomalies
8.4.1 Autoencoders: Learning normality to detect deviance
Explains how an autoencoder learns to reconstruct legitimate transactions and uses reconstruction error to flag unusual transactions as possible fraud.
- Autoencoder reconstruction and encoding: Explain how an autoencoder reconstructs its input by learning a compressed representation and decoding it.
Why it matters: Reconstruction is the task that makes an autoencoder useful for spotting unfamiliar transactions. - Normal-only training and anomaly scores: Explain why training only on legitimate transactions makes reconstruction error useful as an anomaly score, and what a high score means.
Why it matters: This connects learning normal behavior to identifying transactions worth investigating.
Key terms: autoencoder, encoding, decoder, reconstruct, legitimate transactions, reconstruction error, mean squared error (MSE), mean absolute error (MAE), anomaly score
8.4.2 Preparing data for the autoencoder
This section prepares normal-only training data and a mixed test set so an autoencoder can learn legitimate transactions and later be evaluated for fraud detection.
- Normal-only autoencoder training data: Explain why the autoencoder is trained on legitimate transactions and how those transactions are selected from X_train.
Why it matters: What the autoencoder sees during training determines the behavior it learns to reconstruct. - Labels and mixed-set evaluation: Distinguish using labels to select training data from using them as supervised targets, and describe the purpose of the full test set.
Why it matters: This distinction explains why labeled data can help prepare an unsupervised detector without becoming its training target.
Key terms: X_train, y_train == 0, legitimate transactions, X_train_autoencoder_legit, label, supervised learning, X_test, reconstruction errors
8.4.3 Building and training the autoencoder model
This section explains how the autoencoder is structured, why its output is linear, and how it is trained and checked using legitimate transactions.
- Encoder bottleneck and decoder: Describe how the encoder compresses transaction features into a lower-dimensional bottleneck and the decoder reconstructs them, including how the layer structure supports that process.
Why it matters: The compression-and-reconstruction design is the basis for understanding what this model learns to reproduce. - Linear reconstruction output: Justify the linear activation in the final output layer rather than a sigmoid activation.
Why it matters: The output range must fit the values the model is trying to reconstruct. - Legitimate data training checks: Explain how legitimate transactions are used to train and validate the autoencoder, and how training progress and architecture are checked.
Why it matters: Training and validating on legitimate data establishes the reconstruction behavior needed before examining possible anomalies.
Key terms: Encoder, Decoder, latent space, bottleneck, Dense layers, BatchNormalization, linear activation function, standardized, sigmoid, X_train_ae_fit
8.4.4 Calculating and examining reconstruction errors
This section calculates autoencoder reconstruction errors on the full test set and compares them by true class to see whether fraud produces higher errors.
- Per-transaction reconstruction errors: Describe how the trained autoencoder is applied to the full test set and how MSE and MAE are calculated for each transaction.
Why it matters: Per-transaction errors provide the values used to examine whether the autoencoder distinguishes fraud from legitimate activity. - Classwise error comparison: Explain what the true-class summary statistics show about fraud and legitimate transactions, and why that comparison supports anomaly-based detection.
Why it matters: The classwise difference is the evidence behind using reconstruction error as a fraud signal.
Key terms: X_test, MSE, MAE, reconstruction errors, true_class, mean, median, anomaly-based fraud detection
8.4.5 Visualizing reconstruction error distributions
This section uses scatter plots to interpret reconstruction errors and show why they can serve as anomaly scores for fraud detection.
- Reconstruction Error Separation: Explain what the reconstruction-error scatter plots show for legitimate and fraudulent transactions, and why that pattern supports using reconstruction error as an anomaly score.
Why it matters: The visible separation gives a reason to use reconstruction error to flag unusual transactions.
Key terms: reconstruction error, scatter plots, anomaly score, autoencoder
8.4.6 Setting practical thresholds in an unsupervised world
This section explains how to choose, safely test, and maintain reconstruction-error thresholds for live fraud detection when incoming transactions have no fraud labels.
- Unlabeled threshold decision: Explain why a live autoencoder fraud detector needs a reconstruction-error threshold and why that threshold cannot be selected from incoming transactions’ true fraud classes.
Why it matters: The threshold turns an anomaly score into an operational alert, even when the transaction’s true class is unknown. - Normal error percentile threshold: Describe how a trusted set of legitimate transactions can provide a starting threshold for reconstruction errors.
Why it matters: Normal transactions provide a reference for judging which errors are unusually large. - Operational threshold tradeoffs: Explain how review capacity and tolerance for customer friction can shape a reconstruction-error threshold.
Why it matters: An alert cutoff must be workable for investigators and acceptable for customers, not just statistically unusual. - Shadow testing and recalibration: Describe how to validate a proposed threshold safely and why it must be monitored after deployment.
Why it matters: A cutoff that looks reasonable on historical data may cause problems in live use or become unsuitable as behavior changes. - Complementary unsupervised fraud defense: Justify using unsupervised anomaly detection alongside supervised fraud models despite its operational costs.
Why it matters: Fraud tactics change, so a defense based only on previously labeled patterns can miss emerging threats.
Key terms: reconstruction errors, fraud labels, threshold, strategy and monitoring layer, legitimate transactions, golden set, normal error distribution, high percentile, review team capacity, customer friction tolerance
8.4.7 Deploying real-time fraud scoring models: Practical considerations
The section explains how real-time fraud scoring combines distributed components, layered fallbacks, and deployment checks to keep decisions fast and reliable.
- Real-time scoring flow: Trace a transaction from the API gateway through feature enrichment and model serving to a final approve, review, or decline decision.
Why it matters: A fraud model only affects payments when its signals reach a reliable decision flow. - Layered failure fallback: Explain why real-time scoring needs graceful degradation and how the described circuit breaker handles failures of the primary model and its backup.
Why it matters: A scoring failure should not turn into a complete payment-system outage. - Prelaunch performance validation: Describe the section’s checks for latency and for testing a new model on live traffic before it takes over decisions.
Why it matters: Offline model performance does not establish that a new scorer is fast or ready to affect live payments. - Production monitoring and recovery: Explain what teams must monitor and retain after deployment, and how they should prepare to recover from a bad release.
Why it matters: Teams need to spot deteriorating behavior, recover quickly, and account for the decisions the system made.
Key terms: API gateway, low-latency feature store, model serving layer, decision orchestrator, resilience, layered fallback mechanism, circuit breaker, graceful degradation, legacy rule engine, 99th percentile
8.5 Summary
Where this is used later
- Fundamentals of graph data in finance (chapter 9) · Introduces graph data for the interconnected-network domain.
- Synergistic fraud defense: Combining GNNs, LLMs, and future directions (chapter 9) · supervised detection of known fraud patterns
- Key design considerations for GNNs in fraud detection (chapter 9) · The challenges of labeled fraud data.
- (chapter intro) (chapter 9) · Assumes familiarity with supervised fraud classification of individual transactions.
- Hands-on: A simplified GNN for transaction fraud detection with PyTorch (chapter 9) · Supervised fraud classification based primarily on individual transaction features.
Concepts explained in this chapter
- reconstruction lossA reconstruction error is the difference between an input and the output produced when a model attempts to reconstruct that input.
- anomaly detectionThe identification of observations or patterns that substantially differ from expected behavior, including without labeled training examples.
- recallThe proportion of all fraudulent cases found within a selected group of model-ranked cases, such as the top n percent.
- shadow modeShadow mode is a deployment approach in which a model processes live inputs without controlling decisions, allowing its outputs to be evaluated safely.
- autoencoderAn autoencoder is a neural network trained to reconstruct its input, typically by encoding it into a lower-dimensional representation and decoding it.
- supervised learningSupervised learning trains models on labeled examples to predict outputs for new inputs.
- precision at top n percentThe proportion of positive cases among the highest-ranked n percent of cases.
- resamplingChanging a dataset's composition by sampling its observations, often to address class imbalance.
- thresholdA cutoff value used to divide observations or trigger an action based on a measured value.
- monitoringThe ongoing observation of systems, signals, and outcomes to identify changes, failures, or control issues.
- class imbalanceA condition in which a classification dataset has substantially different numbers of observations in its classes.
- fraud detectionThe process of checking activity or applicants for indicators of fraud.
- accuracyAccuracy is the proportion or degree of predictions that a model gets correct relative to the evaluated cases or reference outcomes.
- cost-sensitive learningCost-sensitive learning incorporates differing costs of prediction errors into model training or decision-making.
- f-scoreThe F1 score is the harmonic mean of precision and recall for a classification model.
- precisionPrecision is the proportion of positive classifications made by a system that are correct.
- interpretabilityThe degree to which people can understand the basis of a model’s predictions or decisions.
- concept driftA change over time in the relationship between input data and the target a model is intended to predict.
- confusion matrixA table that summarizes classification results by comparing predicted classes with actual classes.
- hyperparameter tuningHyperparameter tuning is the process of selecting configuration values for a model’s learning procedure to improve its performance.
- pipelineAn ordered sequence of data-processing or modeling steps that transforms inputs into outputs.
- unsupervised learningUnsupervised learning is a machine-learning approach that identifies structure or patterns in data without relying on labeled outcomes.
- false negativeA false negative is a negative classification that incorrectly labels an actual positive case as negative.
- false positiveA false positive is an alert or classification that incorrectly identifies legitimate activity as suspicious or problematic.
- evaluation datasetA portion of data kept separate from model training for evaluation.
- rules engineA software component or system that manages and executes predefined rules against data or events.
- area under the curveThe area under a receiver operating characteristic curve, summarizing a classifier’s ability to distinguish between classes across thresholds.
- labelThe outcome value associated with an example that a predictive model is trained to estimate.
- retrainingModel retraining is the process of training an existing model again, typically with updated data, to refresh its learned parameters.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.
