A Hyperparameter Study for Quantum Kernel Methods

Quantum kernel methods are a promising method in quantum machine learning thanks to the guarantees connected to them. Their accessibility for analytic considerations also opens up the possibility of prescreening datasets based on their potential for a quantum advantage. To do so, earlier works developed the geometric difference, which can be understood as a closeness measure between two kernel-based machine learning approaches, most importantly between a quantum kernel and a classical kernel. This metric links the quantum and classical model complexities, and it was developed to bound generalization error. Therefore, it raises the question of how this metric behaves in an empirical setting. In this work, we investigate the effects of hyperparameter choice on the model performance and the generalization gap between classical and quantum kernels. The importance of hyperparameters is well known also for classical machine learning. Of special interest are hyperparameters associated with the quantum Hamiltonian evolution feature map, as well as the number of qubits to trace out before computing a projected quantum kernel. We conduct a thorough investigation of the hyperparameters across 11 datasets and we identify certain aspects that can be exploited. Analyzing the effects of certain hyperparameter settings on the empirical performance, as measured by cross validation accuracy, and generalization ability, as measured by geometric difference described above, brings us one step closer to understanding the potential of quantum kernel methods on classical datasets.


I. INTRODUCTION
Assessing the performance of quantum models on current quantum computers in tackling machine learning tasks on classical datasets is an enduring ambition of the research community.Many strides have been made addressing this subject from theory-driven approaches that showed encouraging results for specific models, e.g.investigating the difference in capacity between classical and quantum models [2] and showcasing a model that allows to sample from a circuit that is hard to simulate classically [5], to more empiricaldriven projects that showed promising results for specific models on specific use-cases, e.g.medical classification with hybrid quantum-classical convolutional neural network [15] and generation of high-resolution MNIST datapoints with hybrid generative neural networks [21].However, making an overall claim of quantum advantage for a broader class of models for a broader set of use-cases remains challenging, especially due to the notorious insufficiency of theoretical understanding of certain sub-fields of machine learning, such as deep learning (DL) [12].Nevertheless, in the recent years a body of literature emerged linking DL models to kernel methods (KMs) [6], [9], [11] followed by literature making similar conclusion for the quantum domain [20], [8], [22].This is great news due to favorable qualities of KMs, such as exhibiting convex loss landscapes, which allows to establish convergence, and hence trainability, guarantees [22].It is a big advantage in comparison to DL that infamously suffer from non-convex loss landscapes and their quantum counterparts that suffer from barren plateaus [14].Focusing on KMs therefore allows for a more theoretically sound argument, while at the same time the insights gained for KMs can be applied to a broader range of models due to the aforementioned interrelationships.
Huang et al. [7] by arguing from a standpoint of generalization of kernels challenged a common reasoning for claiming quantum advantage that is often used in quantum machine learning (QML) literature.In their work, they showed that a classical intractability of the function, that is represented by a quantum model, is not sufficient to claim a quantum advantage.A classical learner can learn to approximate the quantum output if a sufficient amount of data is available.Following this argumentation, they presented a method that allows to probe specific quantum and classical kernels on a specific dataset to derive a possibility for quantum kernels to exhibit superior performance.The method consists of two steps: (1) a geometric difference (GD) measure is computed between kernel matrices, which allows to determine whether the kernels are different enough for potential quantum advantage to exist; (2) the model complexities of classical and quantum models are compared to determine if their discrepancy is sufficient (high classical and low quantum complexities are desirable).
In this work, we study how the choice of hyperparameters influence the empirical performance of the quantum KMs and how it influences the GD [7].The motivation behind this work is to pinpoint the parameters and ranges which are most crucial to optimize.A second incentive is to deepen our understanding of the relevance of the GD-tool in an empirical setup.We performed an experiment spanning multiple different datasets (classical and artificially labeled), a large hyperparameter search grid and different kernel setups.Our results indicate that the GD depends on the individual hyperparameters to a similar extent as the accuracy, but the optimal values of them differ greatly between the metrics.We found also empirically which parameters are most crucial to optimize and highlight how.

II. BACKGROUND
Previous work by Moussa et al. [17] investigated the importance of hyperparameters of quantum neural networks, in which the performance of different hyperparameter settings has been evaluated on multiple datasets.From their experimental results, it follows that the choice of data embedding, the depth of the quantum circuit and the learning rate of the optimizer are the most important hyperparameters.In this work, we draw our inspiration from their experimental design, but we adapt our search grid to hyperparameters that are meaningful in quantum kernel methods setting and conduct additional analysis to determine versatility of GD as potential metric for hyperparameter tuning.This section provides background information on our approach.

A. Kernel functions
A kernel function k(x, x ′ ) : R D × R D → R is bivariate, real-valued and can be interpreted as a similarity measure between x, x ′ ∈ R D , which is symmetric k(x, x ′ ) = k(x ′ , x) and non-negative k(x, x ′ ) ≥ 0. For any finite set X N ⊂ R D , we can construct a Gram matrix defined by which is Hermitian and positive semi-definite (PSD).According to Mercer's theorem, a Gram matrix with this property allows to represent the kernel function as an inner product of feature vectors k(x, x ′ ) = ϕ(x) T ϕ(x ′ ), where ϕ : R D → H [18] is a feature map that maps original input space into a higher dimensional feature Hilbert space.Depending on a choice of a feature map ϕ, we can generate kernels with different properties.For example, for x ∈ R D we can consider the simplest (linear) map ϕ(x) = x, and we get a linear kernel defined as k(x, x ′ ) = x T x ′ .One of the most widely-used maps ϕ(x) generates a radial basis function (RBF) kernel defined as where γ = σ −2 and σ is known as bandwidth.This kernel has infinite dimensions, which becomes apparent if we consider the Taylor expansion of Eq. (1).Kernels are employed by a variety of machine learning algorithms.One of the most prominent example of such algorithms is a binary linear classifier known as a Support Vector Machine (SVM).The main objective of an SVM is to find a separating hyperplane between two classes of data with the maximal separating margin.However, the data might not necessarily be linearly separable in the input space R D , in which case mapping data into a higher dimensional feature space H is of an advantage.Moreover, one can avoid expensive explicit computation in high or infinite dimensional space by utilizing what is known as a kernel trick.In essence, one computes merely an inner product of two feature vectors without accessing high dimensional space.

B. Hamiltonian evolution feature map
For a quantum algorithm to operate on a classical data, the data has to be embedded into a quantum state ϕ : x i → |x i ⟩, which exists in a complex Hilbert space H that is C 2 n with n being the number of qubits.The significance of the choice of embedding operation for the performance of quantum models has been highlighted in the literature [2], [23].In this work, we concentrate on the Hamiltonian evolution feature map as it has been proven to be powerful in QKM setting [4], [7], [24].This feature map has been developed for many-body problems and is defined as follows where ) with X j , Y j , Z j being Pauli operators acting on j-th qubit, |ψ j ⟩ is a Haar-random state, t and T are hyperparameters that symbolizes total evolution time and number of Trotter steps respectively.The significance of hyperparameter t for QKMs has been highlighted by Shaydulin et al. [24].Our results support and extend their work.

C. Quantum kernels
An inner product of two quantum states defines a quantum fidelity kernel as ( Quantum kernels insert data into exponentially high dimensional Hilbert feature space, which is intractable for classical computers.The high dimensionality of this space has to be treated with caution as it requires N ≥ Ω(2 n ) of training data to approximate a certain function well, where n is amount of logical qubits [7], [10], [19], [26].This is due to a problem known as exponential concentration [26].The same logic holds for a quantum fidelity kernel of mixed quantum states k(x, x ′ ) = T r(ρ(x)ρ(x ′ )) [19].Reducing the dimensionality of the space by projecting it onto a smaller subspace, thereby creating so-called projected quantum kernels, increases the generalization capacity of these methods.To achieve that we can utilize reduced density matrices (RDMs) , where T r ̸ =q stands for a trace of a subsystem that is created by excluding q qubits and Φ is a trace-preserving map.Depending on the choice of the map Φ, different proposals for projected kernels can be found in the literature [7], [10].As generalized by Nakaji et al. [19], these projected (RDM-based) kernel can be categorized into inner product based defined as where α k > 0 are coefficients, and distance based defined as where the Frobenius norm is denoted by ||.|| F , γ > 0 is a hyperparameter, and α k > 0 are coefficients.The subsystem of size K represented by q k is the k-th of the N K possibilities.In this paper an adaptation of the inner product based kernel is considered.The motivation is that the kernel entries can become relatively small for large dimensions and highly entangled states.On the main diagonal the values are related to the purity of a quantum state T r(ρ 2 ), which can become 1 d where d is the dimension of the Hilbert space.The normalized inner product based kernel is defined as and therefore remains a valid kernel, because the same feature vectors as in Nakaji et al. [19] can be found for the redefined density matrices (DMs).This normalization affects all entries in the gram matrix, in particular the main diagonal now consists of just ones, as it is common for kernels in general.

D. Geometric difference (GD)
Huang et al. [7] challenged a common argument for claiming quantum advantage that is often used in QML literature.In their work, they showed that a classical intractability of the function f (x), that is represented by a quantum model, is not sufficient to claim a quantum advantage.Under certain circumstances, a classical learner h(x) can learn to approximate f (x) given a sufficient number N of independent samples from a data distribution D. They showed that an expected error between f (x) and h(x) can be upper bounded as: where s K (N ) is the model complexity of the trained function h(x) and c > 0 is a constant.For that reason, with N ∝ s K (N )/ϵ 2 datapoints a classical model can learn to predict the quantum function f (x) up to an error ϵ.Thus, if the best classical learner h(x) has a low model complexity s K (N ), it will not require too much data N to learn the outputs of the quantum model f (x).From here it follows, that for a quantum advantage to exist it is required that there is the largest possible separation between complexities of quantum and classical models.Huang et al. [7] considered kernel models in their work and defined an asymmetric GD-based test between kernel matrices that captures this separation on a specific dataset.This test is defined as follows: where K C and K Q are classical and quantum kernel matrices with T r(K Q ) = T r(K C ) = N , respectively.The distance based and the normalized inner product based kernels meet this requirement, while the inner product based kernel requires rescaling according to KQ = N • K Q /T r(K Q ) in the case of projected kernels, due to the problem discussed in the previous section that motivated the normalized version.Importantly, this test is reliant on the GD between embedded datapoints, without considering the labeling function.The GD now links the classical model complexity s K C (N ) and the quantum model complexity s K Q (N ) according to which is also a connection of the prediction error bounds as given in Eq. (8).
III. EXPERIMENTAL SETUP In this work we investigate (1) how different parameter settings affect the empirical performance of quantum kernels, as well as their generalization ability, as determined by the GD; (2) whether the GD is a reliable indicator that can be used to optimize the hyperparameters; (3) if normalization can elevate the inner product based kernel.To shed some light on these points we have designed an experiment to evaluate a variety of different hyperparameter settings.In this section, we describe the parameters of the search grid used in our experiment.We varied the types of models and their hyperparameters and tested their performance on various datasets.

A. Models
In this work, we combine classical SVMs (see Section II) from sklearn library with quantum kernels implemented with PennyLane framework on simulators.To obtain the kernel, we first embed classical datapoints with the Hamiltonian evolution feature map as in Eq. ( 2) and the full DM of the resulting quantum state is saved.These DMs are used to compute RDM kernels described in Eq. (4) (with additional rescaling to T r(K Q ) = N ), Eq. ( 5) and Eq.(6).From here forth we will refer to these kernels as inner, distance and inner normalized kernels respectively.In all cases, we set α k = 1/N K .In Section E we discuss the case α k = 1.
From these models we extract relevant hyperparameters.From SVMs we consider regularization hyperparameter C. From the feature map we adopt the number of Trotterization steps T and the evolution time t (as in Eq. ( 2)).The random seed for the initial Haar-random state is set to different values, which however cannot be considered as a hyperparameter.From quantum kernels we take into account the size of the RDM subsystem K (as in Eq. ( 4) and Eq. ( 5)) and, in case of the distance kernel, we also consider bandwidth γ.All hyperparameters of the search grid and their corresponding value ranges are summarized in Table I.
For a classical baseline we train SVM with classical kernels listed in Section II: from basic kernels (linear and polynomial) to more complex ones (RBF and Laplacian) and the (not necessarily PSD) sigmoid kernel.For this comparison the C and γ parameters are explored for the same range as in the quantum case with addition of more standard classical γ choices, such as 1/D and 1/(D • σ(X D )) with D being the dimensionality of the feature space and σ(X D )) variance of the dataset.TABLE II: A comprehensive list of all datasets and their sources that were used in the experiment.If there are 2 possible sources for a dataset and both have been used, both are indicated.

B. Metrics
To rate the importance of the hyperparameters, we need to correlate them with the model's performance.In this paper, we consider performance metrics, such as accuracy on test dataset and mean accuracy of 5-fold cross validation on training dataset, as well as the generalization metric geometric difference (GD) introduced in Section II-D.GD measures the difference between two kernel matrices, so in our studies we consider the GD from quantum to all classical matrices.

C. Datasets
To train and test our models, we selected the 11 different datasets listed in Table II that have been previously used in the QML literature [7], [16], [17], [24].Due to simulation time restrictions, we compress each dataset's feature space to 5 dimensions, which translates to 6 qubits according to Eq. ( 2), and 200 datapoints (or less features/datapoints if fewer were available).In this study, we restrict to binary classification tasks, so for multi-class dataset 8 (Fashion-MNIST) only two classes are selected (T-shirt/Top and Dress) and the rest is discarded.Datapoints with incomplete or missing features are removed as well as duplicate datapoints.In addition, the datasets were balanced.Features with a variance of less than 0.001 were eliminated.All the features were normalized (mean with 0 and variance with 1).To reduce the dimensionality of the features, all features were sorted according to their analysis of variance (ANOVA) F-value, and top 5 were selected.Different preprocessing routines are discussed in Section C.

D. Artificial labels
For a more in-depth study of the GD, we additionally employ a method for generating artificial labels for classical datasets that are more favorable for quantum learners as proposed in [7].This is done by first augmenting Eq. ( 9) to a matrix of form K Q (K C + λId) −1 K Q with the regularization term λ = 1.1.We select eigenvector v that corresponds to the largest absolute eigenvalue, and the intermediate new labels are calculated as y = K Q v.These labels are binarized by setting them to 1 if they are greater than the median of all y and to 0 otherwise.The learning task with these new labels should now saturate Eq. (10).However, the kernel matrices in this scenario are formed using the complete dataset, resulting in slight deviations from this saturation upon separation into training and test sets.To improve generalization, 5% of the labels are randomly set to 0. We use different Haar random initial states for relabeling and learning.Most of the analysis is performed on initial datasets.The relabeled ones are discussed in Section IV-C.

E. Analysis
After all results from the experiments are agglomerated, the data is prepared for further analysis.The choice of the kernel function is treated as a hyperparameter.Our experiments have shown that the inner normalized and inner kernels lead to almost identical predictions and GDs as discussed in Section IV-B2, so we limit our main analysis to the inner and distance kernels.We therefore have only two kernel function which are encoded as the binary variable basis.We also exclude hyperparameter C (as it has no influence on the GD) from the main analysis and discuss it separately in Section IV-B6.For datasets 1 and 8, we removed the highest 3% of each GD due to the presence of significant outliers.These outliers may occur when the classical kernel matrix has nearly singular values (Eq.( 9)) and the GD is therefore exceedingly large.
We start the analysis by investigating the importance of each hyperparameter.Based on the insights from our prior experiments, we chose the Gradient Boosted Decision Trees (GBDT) from sklearn, which is fitted to the experimental data.The features correspond to the hyperparameters and the labels to the accuracies of the earlier classification tasks.Such a GBDT consists of hundreds of decision trees.Depending on how often a certain feature (hyperparameter) is used for a split point, a feature importance can be derived.More precisely, from this model an impurity-based feature importance, also known as the Gini importance, can be extracted.
Additionally, we analyze marginal distributions of each hyperparameter, which is an average over all other hyperparameters to capture the effects of this particular one on the accuracy and the GD to the classical RBF kernel.Apart from the mean, we also track standard deviation as it provides the necessary information regarding reliability of the marginal distribution.A large standard deviation indicates a small importance of that particular hyperparameter on the metric and vice versa.The impact of each hyperparameter on performance and GD is evaluated using the GBDT and its margin plots.II).
The distributions are visualized as boxplots.Additionally, the diamonds indicate the best accuracies achieved by classical and quantum models.The dashed line indicates the accuracy that would be achieved by random guessing.

IV. RESULTS
Fig. 1 visualizes the range of accuracies across different search grid settings as well as best achieved performances of classical and quantum learners (for more details on best learners see Section A).Since the quantum models achieve comparable results to the classical counterparts, we can assume that the explored hyperparameter ranges allowed for a high enough expressivity.Nevertheless, the best classical model can barely be surpassed.The selection of datasets and their characteristics range from those which are easy to learn, to those which are difficult to learn.There is also a varying spread of the accuracies on one specific dataset across the different parameter settings.

A. Hyperparameter importance
We analyze whether accuracy and the GD metrics assign the same importance to the hyperparameters.For that we extract Gini importance from GBDT model fitted to the data extracted from the search grid experiment as described in Section III-E.Fig. 2 displays the average importance found for the different hyperparameters across all the datasets for performance as well as for the GD to the classical RBF kernel.See Fig. 14 for a breakdown of hyperparameter importance by all metrics.
Contrary to our initial expectations, both the performance and GD exhibit minimal sensitivity to variations in the value of K. Also, the number of Trotterization steps T has no significant effect on any of the metrics studied.These results are consistent with [24], where t and T hyperparameters were investigated as well.This analysis also found that the random seed for the Haar initial state had the lowest importance for every metric, but as it cannot be interpreted as a hyperparameter, it will not be discussed further.
Judging from the results in the Fig. 2, the hyperparameter t is assigned the most importance by both the accuracy and  I, across all datasets listed Table II and for both accuracy and GD to the classical RBF kernel.The height of each bar represent mean value while error bars indicate standard deviation.The importance indicates how much influence the variation of this hyperparameter value has on one of the two metrics.These importances were extracted from GBDT model fitted on the results from the search grid (Section III-E).
the GD metrics.The choice of the basis and γ have a strong effect on these metrics as well, as both assigned these two parameters a similar importance that ranks them together at the second place.When examining the standard deviations, it is apparent that the importance of each hyperparameter for the GD is more consistent across the datasets than the importance for the accuracy.

B. Metric dependence on individual hyperparameters
In this section, the effects of individual hyperparameters are discussed.For the most part, we base our assessments on the marginals of the hyperparameters (see Section III-E for further details).The hyperparameters are analyzed in the order of their importance.As expected, the cross validation (CV) aligns closely with the test accuracy in all marginals and is therefore well suited for tuning all hyperparameters.
1) Evolution time (t): Fig. 3 visualizes the marginals of the t parameter for the accuracy and the GD.The standard deviations are illustrated as shadows and indicate the importance of t on each of those metrics.If a standard deviation is small when averaging over all other parameters and datasets, this indicates that the metric does not depend on these other parameters as strongly as on t.This graphic highlights that the t values for which a good performance was achieved corresponds to a rather small GD and as the predictions get worse the potential for quantum advantage increases.This behavior is consistent and sometimes even more significant when looking at individual datasets (Fig. 18 and Fig. 19) or 2-marginals like Fig. 4a.Furthermore, of all hyperparameters, t causes the most differences between the choices of basis.The distance kernel seems to be more resilient for smaller values of t, demonstrated in Fig. 17.As t increases, the GD begins to rise earlier when the distance kernel is used.Fig. 3: Dependence of the GD, the test accuracy and the cross validation accuracy on t (evolution time).The shadows illustrate the standard deviations when averaging over the other parameters and over all datasets.The GD was scaled to the range [0, 1] by dividing through the maximum.
2) (Basis) of the kernel function: In order to have a fair comparison between the distance kernel and the inner kernel the γ parameter is not averaged over, rather the maximal value over this parameter is chosen in all of Section IV, where the choice between the two is considered a parameter too (Section III-E).This is further motivated by the fact that γ along with C are the computationally cheapest hyperparameters to optimize, since the kernel can be reevaluated without having to recompute the distances between DMs.Fig. 5 shows the accuracies achieved for the specific choices of kernel function basis over all other parameter settings (except for γ) and datasets.If γ is optimized, then the distance basis outperforms the other two.In Fig. 16, we observe a different situation when γ is averaged like all the other parameters, but this is mostly due to the broad range (and thus many suboptimal values) we explored.When comparing the two normalization methods (inner and inner normalized) we notice almost no difference in performance or GD.This also applies to the best model for each dataset, as shown in Section A.

3) Gamma (γ):
The second hyperparameter controlling the bandwidth is gamma is γ.This parameter is only relevant for the distance kernel (Eq.( 5)), which is why Fig. 6, Fig. 20 and Fig. 21 are restricted to just the distance kernel.In contrast to the behavior seen in Section IV-B1 the GD is here not necessarily running opposite to the accuracy, which can be seen from Fig. 6 (or Fig. 20 and Fig. 21).There is a general behavior that can be observed for all datasets, which is that all the GDs are increasing with γ.For most datasets the accuracy has a maximum in the range 0.1 − 10 with varying curvature around that point across the different datasets.γ is correlated with other parameters as seen in Fig. 4a and Fig. 4b.For example, the optimal value for t shifts to smaller values with larger γ, which makes sense as the kernel values in general decrease when either of these parameter increases.Fig. 6: Dependence of the GD, the test accuracy and the cross validation accuracy on γ (bandwidth).The shadows illustrate the standard deviations when averaging over all datasets and over the other parameters except for basis, which is restricted to just the distance kernel.The GD was scaled to the range [0, 1] by dividing through the maximum.

Distance
4) Size of the reduced density matrices (K): Here, we are investigating RDMs that have the means to tackle the exponential concentration problem [26].Because datasets 3 and 4 have only 4 features, they are excluded from all RDMmarginals in Section IV as they would bias K = 6.The trend in our results indicates a slight increase in accuracy with this hyperparameter, but minimal effect overall.While GD increases notably with K as displayed in Fig. 4b and Fig. 7.Both observations are consistent across all datasets (Fig. 22 and Fig. 23)).Furthermore, Fig. 2 also indicates the difference in importance.

5) Number of Trotterization steps (T ):
We found that varying T has minimal impact on performance or GD for most datasets, which can be deduced from the large standard deviations in Fig. 8 and the almost absent variation of any metric with increasing T (see also Fig. 24 and Fig. 25).In Fig. 8: Dependence of the GD, the test accuracy and the cross validation accuracy on T (number of Trotterization steps).The shadows illustrate the standard deviations when averaging over the other parameters and over all datasets.The GD was scaled to the range [0, 1] by dividing through the maximum.Fig. 24 only dataset 9 shows more accuracy with higher T .
6) Regularization strength (C): Because C does not affect the kernel, there is no dependence of the GD on it.The accuracy however has a notable dependence especially for smaller values (Fig. 9).The pattern is as expected for this parameter, which is that there is a strong increase in performance up to a global maximum.From there on the quality of the predictions slightly decreases with increasing regularization.There are large discrepancies between the datasets as to where that saturation happens and the slopes before and after (compare Fig. 26).

C. Relabeled datasets
With the method described in Section III-D we relabeled datasets for different quantum kernels.The motivation behind this is to detect differences between the original datasets and datasets that are more favorable for the quantum methods.Since the GD does not depend on the labels, this solely affects the accuracy.As the initial state has a negligible influence on the results (Section IV-A), we limit ourselves to a single random state in this section.
We found that relabeling shifts the optimal hyperparameter values well to the setting for which the relabeling was performed.As an example, Fig. 10 shows the marginal accuracies for the original dataset 6 compared to 2 relabeled versions for the settings: basis = distance, T = 9, K = 6, γ = 1 and either t = 0.5 or t = 32.Furthermore, the GD is plotted for exactly these choices of basis, T , K, and γ.The marginal dependency on t illustrates that the relabeling has shifted the optimal values for this hyperparameter to the settings for which the relabeling was performed.This effect was also observed for other parameters.
When the relabeling is done for t = 0.5 the separation between the best classical and the best quantum accuracy is smaller compared to relabeling for t = 32, which is displayed in Table III.This is expected because the gradient GD increases with t as shown in Fig. 10.Similarly, higher values of K also result in larger GD (see Section IV-B4) in the case of t = 32 this results in a larger separation.However, when t = 0.5, the GD is too small to significantly improve the quantum model's ability to learn the artificial labels in comparison to the classical models.Small deviations in the separation can be explained by TABLE III: List connecting the difference between the best classical and the best quantum accuracies and their separation with the GD.The columns K and t indicate the hyperparameter values for which dataset 6 was relabeled.The other parameters were set to basis = distance, T = 9, K = 6, γ = 1 and α k = 1/N K (Eq.( 4) and Eq. ( 5)) 10 1.5 10 1.0 10 0.5 10 0.0 10 0. for the original dataset 6 and 2 relabeled versions for the settings: basis = distance, T = 9, K = 6, γ = 1 and either t = 0.5 or t = 32.The dependence of the GD on t and for the specific choices of the other parameters is also shown.This metric is universal for the three versions, as the GD does not depend on the labels.Furthermore, it was scaled to the range [0, 1] by dividing through the maximum.The shadows of the accuracies illustrate the standard deviations when averaging over the other parameters.the process described in Section III-D.This process includes applying a regularization term (λId), utilizing a train-testsplit, and incorporating additional randomness, which could explain any variance in the separation.Similar to Table III we discuss Table V in Section E, where we set α k = 1 instead of α k = 1/N K in Eq. ( 4) and Eq. ( 5).

V. PIPELINE FOR INVESTIGATING NEW DATASETS
In this section, we agglomerate lessons-learned into a coherent pipeline for investigating new datasets with QKMs in combination with the Hamiltonian evolution feature map.These insights are specific to our experimental setup (6 qubits systems in a simulation environment, dataset preprocessed in the same way as outlined in Section III-C), however, we believe that these insights might hold true for a broader set of use-cases.
Our experiments have shown the importance of the hyperparameter t, which is responsible for the data scaling and  II and their original feature scales (left).The features are scaled by the best on average t values, which is the parameter that is responsible for the dataset scaling.We consider inner (middle) and distance (right) kernels separately, since the distance kernel has the additional γ hyperparameter that controls bandwidth too, which is closely related to the parameter scaling.
whose importance has been emphasized in [4], [24].This raises an interesting question whether there is a good universal scaling factor for the Hamiltonian evolution feature map.To investigate this, we have found the values of t that provide the best performance in terms of accuracy on average (over all other hyperparameter settings).Additionally, inner and distance kernels are considered separately as the distance kernel has an additional parameter γ, which exerts control over the scaling as well.As can be seen in Fig. 11, the datasets are scaled down to a similar range for both types of kernels separately.From here it follows, that scaling the data down to have standard deviation of approximately 0.49 for the inner kernel and 0.22 for the distance kernel would be a good initial guess.
The findings from the relabeled datasets contrast a universally optimal dataset scaling.As shown in Section IV-C the optimal scale of the input data would actually be far from the [−1, 1] range because the best t value is t = 32.Therefore, the suggested range will be a good initial guess based on the fact that it was observed for all the original datasets, but there is no guarantee connected with it, especially for datasets that might have an inductive bias that favors a QML model.
Similar to the scaling-discussion above, across many datasets the best values for t are usually within the narrow range [0.1, 1] for the inner kernel.The distance kernel also works well for even smaller t (Fig. 17), since this can be compensated for with γ.The hyperparameter γ is correlated with t (Fig. 4b) and has an optimal range of [0.1, 10] (Section IV-B3).
In our study, we observed that T had little influence and could be set, for example, to T = 9 or even smaller to avoid deep circuits.On the other hand, the accuracy was not affected by K, but projecting appeared to hinder GD.Based on our findings, K = 6 would be the optimal selection for our setup.Moreover, this choice is the least computationally expensive, since the number of possible subsystems scales as N !/(N/2)! 2 (binomial coefficient), where N is the number of qubits.The  II) achieved by an SVM with a quantum kernel for a reduced search grid of hyperparameters.The diamonds indicate the best accuracies achieved by classical and quantum models.The dashed line indicates the accuracy of guessing randomly.
pipeline described above can be summarized as follows: • choose K = N , T = 9 and any Haar random initial state; • explore t in the interval [0.1, 1], starting with the one that would scale the data into similar ranges as in Fig. 11; • choose inner kernel to avoid hyperparameter optimization and easier realization; choose distance kernel for a better performance at the cost of optimizing γ (optimize γ and C in a combined fashion); When this pipeline is applied to the datasets in Table II instead of the full grid search of the main experiment (Section III), there is only a minor decrease in best quantum performance while the runtime is reduced significantly.The accuracy distribution in the search grid (Fig. 1) narrows down to the one displayed in Fig. 12.

VI. DISCUSSION
The experiment demonstrated that the distance kernel outperforms the inner kernel when γ is optimized, but when we average γ over the range we investigated, the opposite is true (Fig. 5 and Fig. 16).The inner normalized and inner kernels have almost the same best performances when the inner is scaled to the same norm.Our results also indicate that the each hyperparameter has compatible importance for both the accuracy and the GD (Fig. 2).These importances, which are extracted from the GBDT model (Section III-E), match our intuition based in the standard deviations in the marginals and the formulas.
The γ hyperparameter is easy to optimize in terms of computational resources and because of its single extreme point.Since it can also make or break the distance model, it should be optimized.γ also shows correlations with other parameters, most importantly with t.Since both t and γ regulate the bandwidth, they are interchangeable to a certain degree.Hence, the behavior of the distance kernel over the inner kernel when varying t is more robust.This can be seen in Fig. 4a, which also highlights the fact that the areas with good accuracy and the ones with high GD are rather distinct, especially regarding the dependence on t.The importance of the size of the RDM K is relatively small for the setting we investigated (Fig. 2), but we assume that the importance of this parameter to increase with the number of features (qubit count) as the exponential concentration increases in the same way.Notably, the importance of K also increases when we set α k = 1 (Eq.( 4) and Eq. ( 5)), which is discussed in Section E. This choice however also leads to a stronger dependence of the bandwidth on K. T has a relatively insignificant effect on the performance or the GD as already stated in [24].This suggests that an exact evolution in the Hamiltonian evolution feature map is not necessary, meaning that the approximation one tries to reduce by Trotterization actually does not result in a worse embedding compared to the exact evolution.From the formula stated in Equation (Eq.( 2)), one cannot expect independence from the permutation of the features.In Section D we investigate this effect and determine that different permutations lead to different predictions, but that the impact is not significant.
In supervised learning setup, we can consider on one hand the complexity of the features and on the other hand the complexity of the labels.That the complexity of the labels can completely change assumptions based on the features is the reason why the GD and the accuracy sometimes have different dependencies.It is also the reason why a relabeled dataset and the original one have little similarities in terms of accuracy despite having the same features.The GD, which solely depends on the features is therefore insufficient for indicating the performance as it was already clearly stated in [7], where this metric is only the first split point in the flowchart they suggested.Our experiments also empirically show that the GD cannot be used directly to tune hyperparameters, especially as an alternative to cross validation.Nevertheless, we found areas where the GD and performance behave similarly, oppositely, or independently to the accuracy.These implications might be of relevance in the search for real world datasets with an inductive bias that favors quantum KMs.For example, it might in general be better to have a higher t with a lower γ compared to a low t with a high γ.Both possibilities can have the same accuracy, but the first one is closer to the area with a high GD as the second one based on Fig. 4b and therefore might be a better initial point.Choosing a larger value for K notably increases the GD and slightly enhances performance.This, nonetheless, leads to Hilbert spaces with higher dimensions and convergence of the kernel to a fixed value [26].RDM kernels might remedy this problem by contracting the space, which comes at an expense of the possible expressivity loss (as indicted by GD).T and especially C can be optimized rather independently of considerations of the potential for quantum advantage.

VII. CONCLUSION
To summarize our contributions, in this work we have performed an extensive study of the effects of different hyperparameter settings on the accuracy and the GD score.Our results suggest that even though the hyperparameters have comparable importance for both the accuracy and the GD, the optimal values peaks for the accuracy and GD do not align as well.The most important hyperparameter for both performance metrics is bandwidth t, which enforces the claims that were made in previous literature.This hyperparameter controls the scaling of the input data, and among the investigated datasets, the optimal t corresponded to a scaling of the features in a similar range.The GD and the accuracy were observed to depend in an opposing manner on t.The distance kernel is more robust and performs better than the inner kernel thanks to γ that can be easily optimized and has a similar effect as t.The two alternatives for providing the necessary kernel trace to compute the GD performed almost equally.
Overall, we found optimal ranges for the hyperparameters that work well across the datasets.These findings can be used in order to reduce the computational resources needed when learning a new dataset (Section V).These findings are, however, specific to the size of the feature space (Section III-C) we investigated.One of the main findings of our work concerns K, especially since this hyperparameter has no classical equivalence and has not been subject to many experiments yet.We find that it has the most significant difference in importance for the accuracy and the GD.How this difference changes with higher dimensions of the feature space is left for future investigations.
Relabeled datasets that posses labels that are more favourable to quantum learners show different dependencies and optimal values than the real world datasets.Some findings, like an optimal range for feature scaling, can break down for them.Depending on the choice of prefactors α k in Eq. ( 4) and Eq. ( 5), the observations for relabeling with different K may change.Specifically, setting α k = 1/N K yields greater separation with higher GD, whereas α k = 1 did not produce similar results in our conducted experiments.More studies are necessary to make concussive statements about this connection.
In order to further increase the understanding of the GD we also suggest that more experiments with relabeled datasets, different embeddings and choices of RDM kernels are conducted.Further analyzing the spectral properties of the quantum kernel can shed light on the inductive bias of the model [10], [25].Another interesting future work in context of the quantum Hamiltonian evolution feature map would be to include noise in such a broad hyperparameter analysis, which is ideally done with real hardware runs.Increasing the number of qubits may provide new insights, particularly regarding the role of K.

APPENDIX A ANALYSING DIFFERENT KERNEL FUNCTIONS
To validate our choice of a classical RBF kernel as a benchmark and to investigate how this choice affected GD results, we test other standard kernel functions, such as Linear, Polynomial, Sigmoid and Laplacian, in the same setup.Fig. 13 portraits the best achieved performances by all models on all available datasets.The RBF performs best on average by a small margin.The importance of hyperparameter changes by a small margin as we changes a classical basis of a GD.The importance values shown in Fig. 14 indicate that the dependence of the GD on the different parameters is relatively universal over the choice of the classical kernel to which this GD is taken.To illustrate that the implications of Fig. 5 persist for every dataset individually with little exceptions, we show in Fig. 15 the individual best performance of these three quantum methods (distance, inner and normalized inner) for each dataset.This plot illustrates a slight advantage of the distance kernel that was already determined in the original plot.Additionally, in both Fig. 5 and Fig. 15 we see that the maxima of the accuracies of the inner and the inner normalized align well.Fig. 15: Best achieved test accuracies on each dataset by quantum kernels.The maxima of all three models align very well, with the distance kernels being the best performing quantum kernel by a small margin.When looking at the average (Fig. 5) instead of the maximum accuracy, this becomes even more clear.The inner and the inner normalized align closely.The dashed line indicates the accuracy of guessing randomly.

APPENDIX B ADDITIONAL DETAILS OF EMPIRICAL STUDY
In this section, additional figures are shown to support statements from Section IV.The marginal plots for each dataset show the mean over all other parameter settings as already described in Section III-E.Fig. 17 has the means to highlight the difference between the distance and the inner kernel with focus on the stability of the distance one for small t values.but for an average over γ in contrast to Fig. 5 where this parameter is optimized.The remaining figures in this section have the purpose to display common or different behaviour of the parameter dependencies across the different datasets.

APPENDIX C EFFECTS OF CHANGING DATASET PREPROCESSING STEPS
In addition to the preprocessing routine described in Section III-C we investigated how keeping or dropping correlated features affects the accuracies.For the whole discussion in the main part of this work highly correlated features were kept.In this section _A indicates that any feature, where the correlation with another feature was greater than 0.75 was eliminated.This step affects only datasets 1, 5, 8 and 9.For dataset 8 we also tested the preprocessing steps from [1] (indicated as _B) meaning that the datapoints are scaled to the range [0, 1] and principal component analysis (PCA) was used for dimensionality reduction.We restrict it to just one random initial state for this section.Fig. 27 and Fig. 28         that different preprocessing techniques have the greatest impact on dataset 8, where they lead to better results.This particular dataset is unique, as it is the only one based on image data (and therefore has 784 initial features), compared to an initial number of features of 9, 10, and 30 for datasets 1, 5, and 9, respectively.Furthermore, the sample size for this dataset is substantially larger than the other datasets.

APPENDIX D EFFECTS OF FEATURE PERMUTATIONS
In the quantum Hamiltonian evolution feature map given in Eq. ( 2), each feature acts on the qubit with the same index as the feature and the qubit with this index+1.Thus, unlike most classical kernels, different permutations of the input features do not lead to exactly the same model.Moreover, the last feature is entangled with an additional qubit and therefore depends on only one feature directly.The first qubit also depends on only one feature, while the other qubits depend on two.The optimal permutation is difficult to optimize, so we attempt to gain some insight into the severity of this effect.To this end, we apply the pipeline of Section V to a selection of datasets for each possible permutation of the features.Because the number of possible  I.The different boxplots correspond to different prepossessings of datasets 1, 5, 8 and 9 and are cut off at 10 5 (≈ 1.2% cut off).
permutations N p of the number of features N f grows like N p = N f !, we restrict to just 3 features for this experiment.
For each possible hyperparameter setting, we compute the standard deviation of test accuracy across permutations.These standard deviations are then averaged across settings and listed in Table IV along with the mean test accuracy across all settings and permutations.The values are reported for the GD and the test accuracy.For the specific choice of 3 features and for the datasets we consider, we did not find a noticeable effect on GD, but not much effect on test accuracy (see also Fig. 29).APPENDIX E EFFECTS OF α K PARAMETER Both α K = 1/N K and α K = 1 in equations Eq. ( 4) and Eq. ( 5) result in valid kernels, but we find that the latter choice leads to counter-intuitive observations especially regarding the GD.This choice mainly affects observations based on different values of the hyperparameter K.For example, V is equivalent   The other parameters were set to basis = distance, T = 9, K = 6, γ = 1 and α k = 1 (Eq.( 4) and Eq. ( 5)) to III, but for α K = 1 instead of α K = 1/N K .When we make this choice, we see that relabeling for a larger GD does not necessarily lead to a larger separation between the best classical and the best quantum model in terms of test accuracy.Going from t = 0.5 to t = 32 increases the GD and the separation for both α k .For different K this is not the case.
For α K = 1, the sum over all possible subsystems yields kernel entries that are roughly ∝ N K .This suggests an added scaling factor of the bandwidth, leading to strong correlations between γ and K, as well as t and K, which do not exist for α K = 1/N K .Based on this observation, we conclude that α K = 1/N K is a better choice for this parameter and use it in the main part of this study.

Fig. 1 :
Fig.1: Distribution of accuracies achieved by an SVM with a quantum kernel on the test set for all hyperparameters setting from the search grid (Section III-A) for each dataset (TableII).The distributions are visualized as boxplots.Additionally, the diamonds indicate the best accuracies achieved by classical and quantum models.The dashed line indicates the accuracy that would be achieved by random guessing.

Fig. 2 :
Fig.2: Mean Gini importance for each hyperparameter listed in TableI, across all datasets listed Table II and for both accuracy and GD to the classical RBF kernel.The height of each bar represent mean value while error bars indicate standard deviation.The importance indicates how much influence the variation of this hyperparameter value has on one of the two metrics.These importances were extracted from GBDT model fitted on the results from the search grid (Section III-E).

Fig. 5 :
Fig. 5: Dependence of the test accuracy on the choice of basis for the kernel function.For this comparison γ is optimized and not averaged.The specific form of a distance-, inneror inner normalized based kernel function is given in Section II-C.The dashed line indicates the accuracy that would be achieved by random guessing.

Fig. 4 :
Fig. 4: a Dependence of the accuracy and the GD on γ (bandwidth) and t (evolution time) combined.The graphic displays the mean over all datasets and other parameters.b Different marginals of the accuracy depending on 2 hyperparameters.γ in combination with C (regularization strength), T (number of Trotterization steps) and K (RDM size) as well as t (evolution time) in combination with C (regularization strength).

Fig. 9 :
Fig.9: Dependence of the GD, the test accuracy and the cross validation accuracy on C (regularization strength).The shadows illustrate the standard deviations when averaging over the other parameters and over all datasets.The GD was scaled to the range [0, 1] by dividing through the maximum.

Fig. 10 :
Fig.10: Dependence of the test accuracy on t (evolution time) for the original dataset 6 and 2 relabeled versions for the settings: basis = distance, T = 9, K = 6, γ = 1 and either t = 0.5 or t = 32.The dependence of the GD on t and for the specific choices of the other parameters is also shown.This metric is universal for the three versions, as the GD does not depend on the labels.Furthermore, it was scaled to the range [0, 1] by dividing through the maximum.The shadows of the accuracies illustrate the standard deviations when averaging over the other parameters.

Fig. 11 :
Fig. 11: All datasets from TableIIand their original feature scales (left).The features are scaled by the best on average t values, which is the parameter that is responsible for the dataset scaling.We consider inner (middle) and distance (right) kernels separately, since the distance kernel has the additional γ hyperparameter that controls bandwidth too, which is closely related to the parameter scaling.

Fig. 12 :
Fig. 12: Distribution of accuracies for each dataset (TableII) achieved by an SVM with a quantum kernel for a reduced search grid of hyperparameters.The diamonds indicate the best accuracies achieved by classical and quantum models.The dashed line indicates the accuracy of guessing randomly.

Fig. 13 :
Fig. 13: Best achieved test accuracies on each dataset by classical kernels.The dashed line indicates the accuracy that would be achieved by random guessing.

Fig. 14 :
Fig.14: Importance of each hyperparameter for a collection of metrics.These include the test accuracies and cross validation accuracies as well as the GD to 5 different classical kernels.The errorbars illustrate the standard deviations when averaging the importances across the 11 datasets we considered in our study.

Fig. 16 :
Fig. 16: Dependence of the test accuracy on the choice of basis for the kernel function.In contrast to Fig. 5 γ is averaged over too along with all the other parameters except for basis.The specific form of a distance-, inneror inner normalized based kernel function is given in Section II-C.The dashed line indicates the accuracy of guessing randomly.

Fig. 17 :
Fig.17: Dependence of the test accuracy and the GD on t (evolution time) for the distance and the inner kernel separately. demonstrate

Fig. 18 :
Fig. 18: Dependence of the test accuracy on t (evolution time) for each of the 11 original datasets listed in Table II individually.

Fig. 19 :
Fig.19: Dependence of the GD on t (evolution time) for each of the 11 original datasets listed in TableIIindividually.

Fig. 23 :
Fig. 23: Dependence of the GD on K (RDM size) for each of the 11 original datasets listed in Table II individually.

Fig. 24 :
Fig. 24: Dependence of the test accuracy on T (number of Trotterization steps) for each of the 11 original datasets listed in Table II individually.

Fig. 25 :
Fig. 25: Dependence of the GD on T (number of Trotterization steps) for each of the 11 original datasets listed in Table II individually.

Fig. 28 :
Fig.28: Distribution of GD between a quantum kernel and the classical RBF kernel over all hyperparameters setting given in TableI.The different boxplots correspond to different prepossessings of datasets 1, 5, 8 and 9 and are cut off at 10 5 (≈ 1.2% cut off).

Fig. 29 :
Fig. 29: Distribution of accuracies for dataset 5 with 3 features across different permutations.The dashed line indicates the accuracy of guessing randomly.

TABLE I
Table II individually.Dependence of the test accuracy on γ (bandwidth) for each of the 11 original datasets listed in Table II individually.Dependence of the test accuracy on K (RDM size) for each of the 11 original datasets listed in Table II individually.
Fig. 21: Dependence of the GD on γ (bandwidth) for each of the 11 original datasets listed in Table II individually.
Table II individually.Dependence of the test accuracy on C (regularization strength) for each of the 11 original datasets listed in Table II.Distribution of accuracies achieved by an SVM with a quantum kernel on the test set for all hyperparameters setting given in Table I.The different boxplots correspond to different prepossessings.Additionally, the diamonds indicate the best accuracies achieved by classical and quantum models.The dashed line indicates the accuracy of guessing randomly.

TABLE IV :
List of datasets and the effects of permuting the features.mean denotes the mean value across all hyperparameter settings and permutations and provides context forstd.std denotes the standard deviation across the permutations, from which we then take the mean over all hyperparameter settings.This is given for the test accuracy and the GD.

TABLE V :
List connecting the difference between the best classical and the best quantum accuracy (=separation) with the GD.The columns K and t indicate the hyperparameter values for which dataset 6 was relabeled.