Random Forest is one of the most reliable ensemble classifiers for fraud detection. In the FFD pipeline, it is trained on the GAN-augmented dataset — 50,000 genuine transactions and approximately 984 synthetic/real fraud samples — using 29 PCA-derived features (V1–V28 plus scaled Amount). By constructing many decorrelated decision trees in parallel and combining their votes, Random Forest generalises well even when the minority fraud class is rare.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Antisource/FFD/llms.txt
Use this file to discover all available pages before exploring further.
How Random Forest Works
Random Forest is a bagging (bootstrap aggregating) ensemble method. During training it:- Draws
n_estimatorsbootstrap samples from the training set. - Grows a full decision tree on each sample, but at every split considers only a random subset of features (
max_features). This decorrelates the trees. - At inference time every tree casts a vote and the majority class is returned.
- Handles class imbalance — even without GAN augmentation, the
class_weightparameter can up-weight the minority fraud class automatically. - Built-in feature importance — after fitting,
rf_model.feature_importances_reveals which PCA components drive the fraud signal most strongly. - Low variance — averaging many trees reduces the overfitting that a single deep decision tree would suffer on noisy financial data.
Implementation
The notebook instantiates Random Forest with 100 trees and a fixed random seed for reproducibility:The FFD pipeline uses lowercase
x_train / x_test variable names (the
post-GAN augmented splits). Make sure your preprocessing step exports
variables with the same names before calling fit.Key Hyperparameters
| Parameter | Default | Guidance |
|---|---|---|
n_estimators | 100 | More trees → lower variance; diminishing returns above ~200. Notebook uses 100. |
max_depth | None (fully grown) | Cap depth to reduce overfitting on small fraud clusters. |
min_samples_split | 2 | Raise to 5–10 to avoid leaf nodes with a single fraud transaction. |
max_features | "sqrt" | Default "sqrt" works well for binary classification. |
class_weight | None | Set to "balanced" or {0: 1, 1: 101} when training on the raw imbalanced dataset. |
random_state | 42 | Fixed seed for reproducible splits. Notebook uses 42. |
Evaluation
After generating predictions, compute the full suite of metrics used across all FFD classifiers:classification_report prints per-class precision, recall, and F1 for both Class 0 (genuine) and Class 1 (fraud), making it easy to assess recall on the minority fraud class.
See Also
Training Pipeline
End-to-end pipeline: data loading, GAN augmentation, train/test split, and unified evaluation loop.
Metrics Reference
Definitions of accuracy, precision, recall, and F1 as used across all six FFD classifiers.