The fraudulent use of a credit card or debit card or any other comparable tools to gain money or property is known as credit card fraud. In 2017, 16.7 million people were victims of fraudulent card operations.
Some of the existing methods in classical systems are Artificial Neural Network (ANN), Artificial Immune Systems (AIS), SVM, Hidden Markov Model, Decision Trees and Genetic Algorithm. Although ANN predicts results with high accuracy, there are disadvantages like more time and epochs to converge for a stable prediction, excessive training, poor explanation capability, etc.
Proposed Quantum Neural Design
We are exploring a novel approach using a Hybrid Quantum Artificial Neural Network to predict and mitigate fraud detection problems (2). Quantum machine learning has restrictions on the number of qubits to be utilized. NISQ (Noisy Intermediate-Scale Quantum) era uses Hybrid Quantum models for implementing quantum solutions.
The Hybrid Quantum model comprises input layers, classical layers, quantum layers and output. To make a quantum layer compatible with the other classical layers, we use a quantum class known as Qnode, shown in Figure 1. Qnode encapsulates quantum functions or circuits for mapping the real-world data to quantum space, circuit layer for calculating the gradients and measurement system to measure the output. A real quantum computer or a simulator is a good candidate for the hardware environment or device. Qnode object wraps the device and quantum functions. Once the quantum layer is classified as a Qnode, the machine learning framework will optimize the network like a classical layer (3).
The gradient is calculated using the parameter shift rule inside the quantum layer. Let’s consider it to be a parameterized function of a quantum circuit given as:
𝑓(𝜃)= ⟨𝜑|𝑂𝑔†(𝜃) 𝐵 𝑂𝑔(𝜃)|𝜑⟩
According to the parameter rule, if the generator of gate 𝑔 has only two unique eigenvalues, 𝑣0 𝑎𝑛𝑑 𝑣1, then the derivative of this circuit expectation with respect to gate parameter is proportional to the difference in expectation of two circuits with shifted parameters,
d/dx 𝑓(𝜃) = 𝑟 [ 𝑓(𝜃 + 𝜋4𝑟) − 𝑓(𝜃 − 𝜋4𝑟) ]
Where shift constant 𝑟= 𝛼2(𝑣1− 𝑣0)
Qnode allows better and faster optimization methods than its classical counterparts by quickly calculating gradients.
Conclusion & Results
The results from the experiment are impressive as we could achieve an accuracy of 95.00% with an f1 score of 96.91%. Figure 2 shows the confusion matrix with 30 points misclassified out of the total subset of 600 test samples. It results in the misclassification ratio of 0.05. The worst-case misclassification of categorizing the fraud as Non-fraud is 11, and the calculated ratio is 0.018. The detailed evaluation metrics are given in Table 1.
The visualization of convergence of accuracy and loss with respect to epochs is shown in Figures 3 and 4. In Figure 3, the accuracy of the quantum model has started converging from epoch 2, whereas the classical model needed a total of 6 epochs. Figure 4 shows the classical model took around 6 epochs for a stable answer, but the quantum model could do it within 2-4 epochs.
These results show that leveraging quantum for AI/ML along with better infrastructure, extending these quantum layers to more sophisticated layers, and better utilization of entanglement and superposition features can bring significant advantages in the foreseeable future.
This blog is co-authored by Ijas A H & Abhirami V S.