# Achieving Excellence in Cyber Fraud Detection: A Hybrid ML+DL Ensemble Approach for Credit Cards
## 4 Method
### Deep Learning Techniques
The ReLU activation function is employed in the hidden layers due to its ability to introduce non-linearity. ReLU is computationally efficient and helps in mitigating the vanishing gradient problem, allowing the model to learn more effectively. \begin{table}
\begin{tabular}{l l l} \hline Layer (Type) & Output Shape & Param \# \\ \hline convid (Conv1D) & (None, 15, 32) & 128 \\ batch\_normalization (BatchNorm normalization) & (None, 15, 32) & 128 \\ max\_pooling1d (MaxPooling1D) & (None, 7, 32) & 0 \\ convid\_1 (Conv1D) & (None, 5, 64) & 6206 \\ batch\_normalization\_1 (BatchNorm normalization) & (None, 5, 64) & 256 \\ max\_pooling1d\_1 (MaxPooling1D) & (None, 2, 64) & 0 \\ convid\_2 (Conv1D) & (None, 2, 128) & 24,704 \\ batch\_normalization\_2 (BatchNorm normalization) & (None, 2, 128) & 512 \\ max\_pooling1d\_2 (MaxPooling1D) & (None, 1, 128) & 0 \\ Bidirectional (Bidirectional) & (None, 1, 256) & 263,168 \\ Dropout (Dropout) & (None, 1, 256) & 0 \\ bidirectional\_1 (Bidirectional) & (None, 1, 128) & 164,352 \\ dropout\_1 (Dropout) & (None, 1, 128) & 0 \\ attention\_layer (AttentionLayer) & (None, 128) & 129 \\ dense (Dense) & (None, 64) & 8256 \\ dropout\_2 (Dropout) & (None, 64) & 0 \\ dense\_1 (Dense) & (None, 32) & 2080 \\ dense\_2 (Dense) & (None, 1) & 33 \\ Total params: 469,964 & Trainable params: 469,506 & Non-trainable params: 448 \\ \hline \end{tabular}
\end{table} 
Table 2: The Deep Learning structure. The Algorithm 1 describes a novel hybrid stacking model that combines ML and DL techniques for classification. The process begins by pre-processing the dataset, which involves cleaning, encoding, and normalising the features. Afterward, the data are split into training and testing sets, with the features and target values separated. The training and testing sets are then normalised to ensure that all features contribute equally to the model. The core of the algorithm is the creation of a stacking classifier, where multiple base learners are employed. These learners include RF, SVM, LR, DT, XGBoost, CatBoost, and a hybrid CNN-BiLSTM-Attention DL model. The stacking model uses these base learners to make predictions, which are then combined by a meta-classifier, typically an RF. To evaluate the model, the algorithm applies cross-validation using StratifiedKFold to preserve class distribution in each fold. The model is trained and evaluated over multiple iterations, with performance metrics being recorded and printed after each iteration. The procedure repeats this process n times, ensuring robust evaluation of the stacking model's performance on the test data. This hybrid approach is designed to leverage the strengths of both ML and DL models for improved classification accuracy and generalisation. ```
1. Procedure Stacking Hybrid ML+DL_model (X, y, n, cv_folds, test_size)
2. Pre-process (X, y)
3. Split data into (X, y)
4. Normalize (X_train, X_test)
5. Model \(\leftarrow\) Create stacking classifier with RandomForestClassifier
6. as meta-classifier()
7. ('Random Forest', rf_classifier)
8. ('SVM', svm_classifier)
9. ('Logistic Regression', lr_classifier)
10. ('Decision Tree', dt_classifier)
11. ('XGBoost', xgb_classifier)
12. ('CatBoost', catboost_classifier)
13. ('CNN-BiLSTM-Attention', CNN-BiLSTM-Attention_classifier)
14. 15. Cross-validation: StratifiedKFold with cv_folds
16.for k \(\leftarrow\) 0 to n-1 do
17. Train StackingClassifier (X_train, y_train)
18. Predict y_pred on (X_test)
19. Evaluate Model(X_test, y_test)
20. Print Evaluation Metrics
21. 22.endfor
23.End Procedure
```  
**Algorithm 1**Novel hybrid stacking ML+DL model