Skip to main content

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.

The Financial Fraud Detection (FFD) pipeline draws on a focused stack of data science, deep learning, and visualization libraries. The GAN-based data augmentation layer relies on TensorFlow 2.11 with its Keras API, while the six supervised classifiers are provided by scikit-learn, XGBoost, and LightGBM. Visualization of results and network architecture is handled by Matplotlib, Seaborn, Plotly, and visualkeras. The pipeline requires Python 3.8 or later; Python 3.10 was used during development.

Installation

Install all required packages in a single command, or use the separate pinned-version command for TensorFlow to avoid resolver conflicts.
pip install tensorflow==2.11 visualkeras numpy pandas scikit-learn seaborn matplotlib plotly xgboost lightgbm
TensorFlow is pinned to ==2.11. The GAN architecture and Keras API calls in this notebook were written against TensorFlow 2.11. Newer major versions (2.12+, and especially the TensorFlow 2.16 / Keras 3 split) introduce breaking API changes — for example, the tensorflow.keras import path and the Adam optimizer signature differ in later releases. Do not upgrade TensorFlow without auditing every tf.keras call in the notebook first.

Core Dependencies

PackageVersionPurpose
tensorflow==2.11GAN model building and training via the Keras API
visualkeraslatestNeural network architecture visualization
numpylatestNumerical computing and array operations
pandaslatestDataset loading, manipulation, and inspection
scikit-learnlatestPreprocessing, classifiers, evaluation metrics, and data splitting
xgboostlatestXGBoost gradient-boosted tree classifier
lightgbmlatestLightGBM gradient-boosted tree classifier
seabornlatestStatistical data visualization (heatmaps, distribution plots)
matplotliblatestGeneral-purpose plotting and figure generation
plotlylatestInteractive visualizations (scatter plots, class distribution)
All packages except tensorflow and visualkeras are installed at their latest stable release. If you need a fully reproducible environment, pin every package to the version resolved during your first install by running pip freeze > requirements.txt after the initial setup.

TensorFlow / Keras Modules Used

The GAN generator, discriminator, and combined model are assembled entirely through the tensorflow.keras API. The following sub-modules are imported by the notebook:

tensorflow.keras.layers

  • Input — defines the input tensor shape
  • Dense — fully connected layer
  • BatchNormalization — stabilizes GAN training
  • LeakyReLU — activation function for generator/discriminator
  • Dropout — regularization to reduce overfitting

tensorflow.keras.models

  • Model — functional API model container (GAN assembly)
  • Sequential — sequential model container (classifier heads)

tensorflow.keras.optimizers

  • Adam — adaptive optimizer used for both generator and discriminator training

tensorflow.keras.initializers

  • RandomNormal — weight initializer for GAN layers, controls initial weight distribution
import tensorflow as tf
from tensorflow.keras.layers import Input, Dense, BatchNormalization, LeakyReLU, Dropout
from tensorflow.keras.models import Model, Sequential
from tensorflow.keras.optimizers import Adam
from tensorflow.keras.initializers import RandomNormal

scikit-learn Modules

scikit-learn provides the complete preprocessing, classification, and evaluation infrastructure for FFD. The table below maps each imported module to its role in the pipeline:
ModuleImported SymbolRole
sklearn.preprocessingStandardScalerStandardizes features to zero mean and unit variance before model training
sklearn.decompositionPCAReduces feature dimensionality for visualization and GAN input
sklearn.utilsshuffleRandomly shuffles combined real + synthetic data before training
sklearn.ensembleRandomForestClassifierEnsemble tree-based classifier
sklearn.svmSVCSupport Vector Machine classifier
sklearn.neighborsKNeighborsClassifierK-Nearest Neighbours classifier
sklearn.naive_bayesGaussianNBGaussian Naive Bayes classifier
sklearn.metricsaccuracy_score, precision_score, recall_score, f1_score, classification_report, confusion_matrixFull suite of binary classification evaluation metrics
sklearn.model_selectiontrain_test_splitSplits dataset into training and test sets
from sklearn.utils import shuffle
from sklearn.decomposition import PCA
from sklearn.preprocessing import StandardScaler
from sklearn.ensemble import RandomForestClassifier
from sklearn.svm import SVC
from sklearn.neighbors import KNeighborsClassifier
from sklearn.naive_bayes import GaussianNB
from sklearn.metrics import precision_score, recall_score, f1_score
from sklearn.metrics import classification_report, confusion_matrix, accuracy_score
from sklearn.model_selection import train_test_split
XGBoost and LightGBM are imported directly via their own packages (import xgboost as xgb, import lightgbm as lgb) rather than through scikit-learn wrappers, though both expose a scikit-learn-compatible fit / predict interface.

Build docs developers (and LLMs) love