XGBoost (eXtreme Gradient Boosting) is a high-performance gradient-boosted tree library that is routinely state-of-the-art on structured/tabular data — the category that credit card transaction datasets firmly belong to. In the FFD pipeline,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.
xgb.XGBClassifier is trained on the GAN-augmented dataset of ~51k samples and 29 PCA features, exploiting its built-in regularisation to learn sharp, fraud-specific decision boundaries without overfitting.
How XGBoost Works
XGBoost is a sequential ensemble method: each new tree is trained to correct the residual errors of the combined model so far. Formally it minimises an objective that adds a differentiable loss term plus explicit regularisation:Ω(f) = γ·T + ½λ·||w||² penalises tree complexity (number of leaves T) and leaf weight magnitude (L2 penalty λ). An optional L1 penalty α can also be added.
Key differentiators from standard gradient boosting:
- L1/L2 regularisation on leaf weights — reduces variance and is rarely seen in classical GBDT frameworks.
- Second-order gradient statistics — uses both gradient and Hessian of the loss for more accurate step sizes.
- Handles missing values natively — learns the optimal default direction for each split when a feature value is absent.
- Column (feature) subsampling — analogous to Random Forest’s feature randomisation; improves generalisation.
- Parallelised tree construction — split finding is parallelised across features, making training fast despite the sequential boosting.
Implementation
The notebook instantiatesXGBClassifier with a fixed random seed and all other parameters at their library defaults:
XGBoost uses
random_state (scikit-learn API) which is internally mapped to
the seed parameter. Fixing it ensures that the column-subsampling
randomisation is reproducible across runs.Key Hyperparameters
| Parameter | Default | Guidance |
|---|---|---|
n_estimators | 100 | Number of boosting rounds. More rounds → lower bias; combine with early_stopping_rounds to avoid overfitting. |
max_depth | 6 | Maximum depth of each tree. Shallower trees (3–5) generalise better on small fraud clusters. |
learning_rate | 0.3 | Step size shrinkage. Lower values (e.g. 0.05) require more estimators but often generalise better. |
subsample | 1.0 | Fraction of training samples used per boosting round. Values 0.7–0.9 add stochasticity and reduce overfitting. |
colsample_bytree | 1.0 | Fraction of features sampled per tree. 0.7–0.9 is a common starting point. |
reg_alpha | 0 | L1 regularisation on leaf weights. Increase to drive sparse feature usage. |
reg_lambda | 1 | L2 regularisation on leaf weights. Increase to reduce leaf weight magnitude. |
scale_pos_weight | 1 | Ratio of negative to positive class counts. Set to num_genuine / num_fraud ≈ 101 when training on the raw imbalanced dataset. |
random_state | 42 | Reproducibility seed used in the notebook. |
Evaluation
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.