# Generative Modeling for Imbalanced Credit Card Fraud Transaction Detection
## 4 Methodology and Materials
### Evaluation Metrics  
In this study, we evaluate the classification performance of supervised learners using a range of performance metrics. These include accuracy, precision, sensitivity, specificity, G-mean, and F-measure. These metrics provide a comprehensive evaluation of the classifiers' ability to distinguish between fraudulent and legitimate transactions. For binary \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Minority** & **Majority** & **Total** & **Minority Imbalance** & **Features** \\ \hline
492 & 284,315 & 284,807 & 0.1727\% & 29 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Credit card fraud detection dataset class characteristics. classification problems, such as fraud detection, it is conventional to use a confusion matrix to summarize the classification results. The confusion matrix consists of true positives (TPs), false positives (FPs), false negatives (FNs), and true negatives (TNs). These values are crucial for calculating the following metrics:  
* **Accuracy**: This metric measures the overall correctness of the model by comparing the number of correct predictions (both true positives and true negatives) to the total number of cases. It is calculated as follows: \[\text{Accuracy}=\frac{TP+TN}{TP+FP+FN+TN}\] (7)
* **Precision**: Precision indicates the accuracy of positive predictions and is calculated as follows: \[\text{Precision}=\frac{TP}{TP+FP}\] (8)
* **Sensitivity (recall or true positive rate)**: This metric measures the ability of the model to identify true positive cases. It is calculated as follows: \[\text{Sensitivity}=\frac{TP}{TP+FN}\] (9)
* **Specificity**: Specificity measures the proportion of true negatives correctly identified by the model and is calculated as follows: \[\text{Specificity}=\frac{TN}{TN+FP}\] (10)
* **G-mean**: The G-mean metric is a geometric mean of sensitivity and specificity. It provides a balance between these two metrics and is particularly useful in imbalanced datasets: \[\text{G-mean}=\sqrt{\text{Sensitivity}\times\text{Specificity}}\] (11)
* **F-measure**: The F-measure, or F1 score, is the harmonic mean of precision and recall. It provides a single score that balances the importance of both metrics: \[\text{F-measure}=2\times\frac{\text{Precision}\times\text{Recall}}{\text{ Precision}+\text{Recall}}\] (12)  
Traditional metrics like accuracy can be misleading due to the imbalance in the dataset. For instance, a model that predicts all transactions as legitimate could still achieve high accuracy due to the overwhelming number of legitimate transactions. To address this, we also consider the G-mean and F-measure, which are better suited for evaluating models on imbalanced datasets. G-mean ensures that the classifier performs well on both classes, while F-measure balances the trade-off between precision and sensitivity. These metrics, along with the analysis of the confusion matrix, provide a comprehensive view of the classifier's performance and its effectiveness in distinguishing between fraudulent and legitimate behaviors. This approach allows us to better understand the strengths and weaknesses of the classifiers and the impact of class imbalance on the classification results. In addition, for an accurate comparison, we created a new metric based on Table 3, which summarizes all the proposed metrics in this paper. This new metric, called the Balanced Fraud DetectionScore (BFDS), combines key performance indicators to provide a comprehensive evaluation of the model's effectiveness in fraud detection. The formula for calculating the BFDS is  
\[\text{BFDS} =0.117\times\text{Accuracy}+0.150\times\text{Precision}+0.167\times \text{Recall}+\] \[0.133\times\text{G-Mean}+0.117\times\text{Specificity}+ \tag{13}\] \[0.150\times\text{F-Measure}\]  
The coefficients in the BFDS formula are designed to reflect the importance of each evaluation metric in fraud detection. Metrics like recall, precision, and F-measure are assigned higher weights due to their role in identifying fraud while minimizing errors.