# Optimization Strategies in Quantum Machine Learning: A Performance Analysis
## 3 Model Architecture
### Ansatz:  
An ansatz in quantum computing refers to a parameterized trial wave function that guides the optimization process. It is implemented as a parameterized quantum circuit, enabling the exploration of various quantum states through adjustments to the trainable parameters (\(\theta\)). The ansatz influences how these parameters (\(\theta\)) can be optimized or trained to minimize the cost function in the algorithm. Thus, the choice of ansatz significantly influences the efficiency and effectiveness of the optimization process [11; 33].  
For this model, the Real Amplitudes ansatz was selected due to its simplicity and computational efficiency. This ansatz consists of layered RY gates and Controlled-X (CNOT) gates, which introduce entanglement between qubits [33; 34]. The specific details are as follows:  
* The model employs a four-qubit Real Amplitudes ansatz with two layers of gates;
* In each layer, an RY gate is applied to each qubit with rotation angle \(\theta\);
* The rotation angles \(\theta\) are adjusted iteratively during the optimization process to minimize the cost function;
* CNOT gates are applied to create entanglement between qubits [35].  
Figure 5 illustrates the Real Amplitudes ansatz unit circuit:  
Figure 4: Decomposition of \(Z\) feature map gate.  
Figure 5: Real Amplitudes ansatz unit circuit.  
The mathematical equation is  
\[RealAmplitudes=\prod_{i=0}^{n-1}RY(\theta_{i}^{1})\ \cdot\prod_{j=0}^{n-2}CNOT\ (\ j,\ j+1)\cdot\prod_{i=0}^{n-1}RY(\theta_{i}^{2})\]  
where  
* RY (\(\theta\)) represents the rotation gate around the Y-axis with rotation angle \(\theta\);
* CNOT(j, j + 1) denotes the CNOT (Controlled-NOT) gate with control qubit j and target qubit j + 1;
* N is the number of qubits, four in this case.
* Cost function:  
The cost function is a crucial aspect of the VQA, measuring the discrepancy between the quantum circuit's output and the desired result. It quantifies how well the trainable parameters \(\theta\) approximate the target quantum solution [11]. In this study, the absolute error loss function was employed to evaluate the model's performance. For each data point, the absolute error is computed as the absolute difference between the predicted value and the true label [36]. This metric ensures that the optimization process focuses on minimizing prediction errors across the dataset.  
* Model Building:  
The model utilized the Cleveland dataset, which contains 303 instances with 14 features relevant to heart disease. The data were split into 80% for training and 20% for testing.  
All experiments were conducted using Colab Python, 3.11.12 with the model running on an Aer Simulator. The simulations were noise-free, employing 1024 shots per circuit execution. Furthermore, a random seed has been set to the common value of 42 to ensure reproducibility.  
The following Python packages were used in this research:  
* Data Visualization: matplotlib.pyplot and seaborn.
* Data Preprocessing: sklearn.preprocessing (StandardScaler, MinMaxScaler) for scaling, sklearn.model_selection (train_test_split) for splitting, and sklearn.decomposition (PCA) for dimensionality reduction.
* Performance Evaluation: sklearn.metrics.
* Quantum Computing: qiskit for circuit design and simulation and qiskit_machine_learning (NeuralNetworkClassifier, CircuitQNN) for quantum neural network implementation.
* Optimization: qiskit.algorithms.optimizers (L-BFGS-B, COBYLA, ADAM).