Importance of Kernel Bandwidth in Quantum Machine Learning

Quantum kernel methods are considered a promising avenue for applying quantum computers to machine learning problems. Identifying hyperparameters controlling the inductive bias of quantum machine learning models is expected to be crucial given the central role hyperparameters play in determining the performance of classical machine learning methods. In this work we introduce the hyperparameter controlling the bandwidth of a quantum kernel and show that it controls the expressivity of the resulting model. We use extensive numerical experiments with multiple quantum kernels and classical datasets to show consistent change in the model behavior from underfitting (bandwidth too large) to overfitting (bandwidth too small), with optimal generalization in between. We draw a connection between the bandwidth of classical and quantum kernels and show analogous behavior in both cases. Furthermore, we show that optimizing the bandwidth can help mitigate the exponential decay of kernel values with qubit count, which is the cause behind recent observations that the performance of quantum kernel methods decreases with qubit count. We reproduce these negative results and show that if the kernel bandwidth is optimized, the performance instead improves with growing qubit count and becomes competitive with the best classical methods.


INTRODUCTION
Algorithms designed for quantum computers are theoretically able to provide exponential speedups over the best known classical algorithms for certain problems, most famously integer factoring [1]. Recent advances in quantum computing hardware open the possibility of realizing this potential. Urgently needed, however, is development of novel algorithms that effectively leverage the power of quantum computation. A particularly promising problem domain is machine learning, owing to the ubiquity of machine learning problems in science and technology.
A number of approaches have been proposed for applying quantum computers to machine learning problems. In this work we focus on a subset of such approaches that can be reformulated as kernel methods. The central idea of kernel methods is to embed the data into a feature space (typically, of dimension higher than the input data) in which it becomes easier to analyze. The analysis is then performed by using solely the values of similarities (kernel values) between the representations of the data points in feature space. Most supervised machine learning methods (quantum or classical) can be equivalently reformulated as kernel methods with an appropriately defined (potentially, quantum) kernel [2,3]. Quantum kernel methods [4,5] have been shown to theoretically provide speedups over classical methods [6,7]. In quantum kernel methods, datapoints are mapped to quantum states using a quantum feature map, and the value of the kernel between two datapoints is given by some similarity measure (such as fidelity) of the corresponding quantum states. The power of quantum kernel methods comes * ruslan.shaydulin@jpmchase.com from being able to process the data using an exponentially sized Hilbert space, performing computations that are hard classically even for sizes attainable on currently available quantum hardware [8].
Recently, the exponential dimensionality of the space into which the classical data is being mapped has been identified as a potential obstacle to achieving quantum advantage using kernel methods. The fidelity of two random quantum states decreases exponentially with the number of qubits (typically set to be equal to the number of dimensions of the input data), leading to the exponential vanishing of kernel values and making learning impossible [9]. This behavior is analogous to the curse of dimensionality in classical kernel methods [10] and not specific to the choice of fidelity as the similarity measure. One recently proposed approach to overcome this limitation is controlling the inductive bias of the quantum kernel methods by projecting the quantum state into a lower-dimensional subspace [7,11]. In general, however, additional information is required to appropriately choose the projection [11].
These no-go results [7,11] depend crucially on the quantum feature map being fixed as the number of qubits grows. However, this overlooks the important role hyperparameters play in machine learning. Hyperparameter tuning is known to be central to the good performance of classical machine learning models in general and classical kernel methods in particular [3]. One such hyperparameter is kernel bandwidth, which is known to affect the performance of methods such as support vector machines (SVMs) and is routinely optimized when SVMs are used in practice. Recently, attempts have been made to introduce similar hyperparameters into the quantum models [12][13][14]. At the same time, no evidence has been shown that these hyperparameters enable the quantum model to maintain performance as the number of qubits grows, which is a prerequisite for quantum advantage.
In this work we identify quantum kernel bandwidth as a centrally important hyperparameter for quantum kernel methods. We demonstrate that varying it controls the expressiveness of the model, with high bandwidth leading to underfitting and low bandwidth to overfitting. We show that for the quantum feature maps considered, the bandwidth can be controlled by rescaling the datapoints. We draw an analogy with the bandwidth of classical radial basis function (RBF) kernels and show that varying bandwidth affects expressiveness of the model in a similar way in both quantum and classical cases. As a consequence of the effect of the bandwidth on generalization, optimizing the bandwidth can improve the performance from being comparable to a random guess to being competitive with the best classical methods. We reproduce recent numerical results used to support an argument against quantum kernels [7]. We show how changing the value of the kernel bandwidth can lead to significantly better performance than the results in [7]. Moreover, we observe that when the bandwidth is optimized, the performance of quantum kernel methods improves with qubit count, which is the opposite scaling behavior from the one documented in [7]. We provide extensive numerical evidence of the importance of the bandwidth and its effect on model generalization and performance with varying qubit count, performing simulations with multiple quantum feature maps and datasets using up to 26 qubits. We show that hardware limitations, such as finite precision of controls and the variance introduced by sampling, are not obstacles to achieving the observed performance.

Setup
We begin by formalizing our notions of quantum kernels, quantum feature maps, and machine learning problems, as well as establishing notation. We consider the problem of supervised learning, specifically the task of classification, although we expect our conclusions to apply more generally. Given a training dataset of N pairs 1} is a binary label produced by some unknown map m : R d → {0, 1}, the goal is to learn a map from datapoints to labels that agrees with the true map m with high probability on an unseen test set.
We consider quantum models where a datapoint x i is encoded in a quantum state |x i by a parameterized unitary: |x i = U enc (x i ) |0 . We will refer to the unitary U enc as a quantum feature map. A kernel matrix K is obtained by computing K ij = k(x i , x j ) = | x i |x j | 2 (the quantum kernel) for all pairs of datapoints. This value can be computed on a quantum computer by measuring the value of observable |0 0| on the state U † enc (x i )U enc (x j ) |0 . This kernel matrix is then used inside an SVM or other kernel methods [15,16]. A quan-tum feature map and a classical kernel method such as an SVM fully define a quantum kernel method.
In this paper we use the quantum kernel matrix in a support vector classifier (SVC). SVC seeks an optimal separating hyperplane between two (potentially nonseparable) classes in the feature space. An optimal hyperplane is one that maximizes the distance (margin) to the closest point from either class [17]. The hyperplane is found by determining coefficients α ∈ R N that maximize the objective function subject to N i=1 α i y i = 0 and 0 ≤ α i ≤ C, i = 1, . . . , N . The penalty term C > 0 controls the trade-off between the goals of minimizing the training error and maximizing the margin: smaller values of C lead to larger margin at the cost of higher training error.

Motivating example
The recent results on quantum kernel methods do not explicitly study the choice of hyperparameters in quantum feature maps. As a motivating example, we consider the paper [7], which includes numerical experiments on the performance of the quantum kernel method with the feature map given by where Here x j , y j , and z j are the Pauli operators acting on qubit j, and |ψ j is a Haar-random single-qubit state. The Haar-random state |ψ j is sampled and fixed for each qubit. This feature map represents a d-dimensional datapoint as a d+1-qubit quantum state [18]. We refer to this feature map as the Hamiltonian evolution feature map. The feature map given by equation 2 has two hyperparameters: the total evolution time t (equivalent to the scaling of the inputs x i ← tx i ) and the number of Trotter steps T . Huang et al. [7] set t = d 3 and T = 20 and reported prediction accuracy on the test set of the quantum kernel method (SVC) with this feature map on the Fashion-MNIST (fmnist) dataset [19]. Each datapoint is reduced to the specified number of dimensions by using principal component analysis (PCA). In Fig. 1b we present the results reported in [7] and the results we reproduced independently. The details of the SVC implementation and data preprocessing are given in the Methods section. Our reproduced results are presented as boxplots over 20 choices of the Haar-random initial  state fixed across all qubit counts, with the box showing the middle 50% quantile range and whiskers showing minimum and maximum. The reported and reproduced results agree well, and both show that the performance of the quantum kernel method decreases with increasing qubit count, approaching the performance of a random guess (i.e., 0.5 accuracy) at about 20 qubits. While Huang et al. [7] performed extensive hyperparameter optimization of both the SVC that uses the quantum kernel and the classical methods with which the quantum kernel method is compared, no hyperparameter optimization is reported for the quantum feature map itself. In fact, choosing t = 0.05 and keeping everything else fixed lead to much better performance, approaching the performance of the best classical machine learning methods (see Fig. 1b). The reason is that the parameter t controls the bandwidth of the quantum kernel. Large values of t lead to the kernel's being too "narrow" (small bandwidth), making learning impossible. We discuss the relationship between the scaling factor, quantum kernel bandwidth, and model performance in detail below.
In addition to providing improved performance, this hyperparameter choice leads to an opposing conclusion about the scaling of the performance with qubit count: in this case, the performance increases with qubit count until plateauing at about 14 qubits. The improvement in performance can be partially explained by observing that with larger qubit count, more components are kept in the PCA-based reduction, thereby giving the model access to a larger part of the explanation of variance in the data. Unlike the previous results [7,11], we do not observe a large drop in performance for larger qubit counts. This example highlights the importance of hyperparameter selection in determining the effectiveness of quantum kernel methods.

Importance of hyperparameters in quantum machine learning
We now show that the ability of hyperparameter choice to make or break performance of a quantum kernel method is not limited to the above example. To this end, we perform a systematic study of how bandwidth affects the prediction accuracy of quantum kernel methods. In addition to the Hamiltonian evolution feature map given in Equation 2, we consider a feature map inspired by the instantaneous quantum polynomial (IQP) circuits used in [5,7]: where (5) We endow this feature map with a hyperparameter λ > 0 analogous to the total evolution time in the Hamiltonian evolution feature map. Since both hyperparameters are equivalent to a rescaling of the input data, we refer to them as "scaling factors." The scaling factor λ can be subsumed into the definition of the input data by setting x i ← λx i . The scaling factor can be understood as a hyperparameter of the quantum feature map since it can always be included in the definition of the feature map if an assumption on the input data distribution is made (e.g., the data has mean zero and standard deviation one). We show below that the scaling factor behaves analogously to bandwidth in classical kernel methods.
The performance is evaluated on three real-world datasets. In addition to the Fashion-MNIST (fmnist)  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17  18  19  20  21  22  23  Random  dataset, we use Kuzushiji-MNIST (kmnist), a dataset containing cursive Japanese characters [20], and a cosmological dataset focused on the task of supernova classification (plasticc) [21]. Two of the datasets were used to study quantum kernel methods (fmnist in [7] and plasticc in [22]). The datasets are balanced; that is, the number of datapoints with label 0 is approximately equal to the number of datapoints with label 1 for both training and testing datasets. All input data is normalized to be centered around zero with the standard deviation of approximately one. A precise description of the experimental setup is given in the Methods section.
We observe that hyperparameter selection significantly affects the performance of quantum kernel methods. We find in particular that the performance of the models varies drastically with the scaling factor (bandwidth). This relationship is presented in Figs. 2a and 2c. Since no significant effect is observed from varying the number of Trotter steps T in the Hamiltonian evolution feature map, here and for the remainder of the paper we set T = 40; results with other values are available in the Supplementary Information. We observe a clear trend in optimal values of the scaling factor, with larger values leading to overfitting and smaller values to underfitting. This relationship is schematically presented in Fig. 1a. Counterintuitively, the scaling factor of one (corresponding to the data having standard deviation of approximately one) is a bad choice for all the datasets and fea-ture maps considered.
We can understand the importance of the scaling factor by considering the relationship between qubit count, scaling factor, and the values of the kernel matrix. The performance of SVC is sensitive to kernel bandwidth. If the kernel bandwidth is too small (kernel is "narrow"), then the kernel matrix will be close to identity; and if the bandwidth is too large (kernel is "wide"), all kernel matrix entries will be close to one. In both scenarios learning is impossible, which is why kernel bandwidth is routinely optimized in classical kernel methods. Scaling factor is analogous to kernel bandwidth for quantum kernels. When the scaling factor is large, the kernel matrix approaches identity as the qubit count grows. Correspondingly, when the scaling factor is small, kernel matrix entries all approach one. This relationship is shown in Fig. 3b. Both of those extremes lead to suboptimal performance (see Fig. 3a); the goal of hyperparameter optimization is therefore to find the "Goldilocks" value of the scaling factor. We discuss the analogy with classical kernel bandwidth and the effect on model generalization in detail below by comparing the behavior of quantum kernels with that of the classical RBF kernel. Previously, in [22] rescaling of the data was shown to lead to an improvement in performance of SVC with a different feature map applied to the plasticc dataset.
Let us now consider the impact of scaling factor and qubit count on the values of the kernel matrix. First,  note that if the data is rescaled by λ, then the operator (5) becomes Analogous behavior can be easily shown for the Hamiltonian evolution feature map. This highlights the exponential relationship between the scaling factor and the kernel value for the family of kernels considered in this work. Figure 3c numerically elucidates this exponential relationship by plotting k(λx i , λx j ) against k(x i , x j ) λ for two fixed datapoints. Second, note the exponential relationship between the qubit count and the kernel value. As the number of qubits grows, the fidelity of two random states decays exponentially. Correspondingly, the fidelity of the embeddings |x i of the datapoints, equal to the value of the quantum kernel of the datapoints, also decays exponentially. This can be observed in Fig. 3d, which shows the scaling of the value of the kernel of two points with the number of qubits. The points in Fig. 3d are sampled from a normal distribution with mean zero and standard deviation of one ("Normal") or are taken from the fmnist dataset, preprocessed as described in the Methods section, and scaled to have mean zero and standard deviation one. In both cases, the exponential decay in the kernel value with qubit count is clearly visible. These two exponential relationships have important implications since high qubit count is a necessary (but not sufficient) prerequisite for the possibility of quantum advantage. While the kernel value decays exponentially irrespective of the fixed value of the scaling factor, selecting a scaling factor based on the qubit count may mitigate the effects of this decay.
For the datasets and feature maps considered, and the range of qubit counts accessible in classical simulation, we find that choosing one fixed scaling factor leads to good performance. However, we expect that in general the value of scaling factor will vary with qubit count, data properties and the feature map structure. For example, we anticipate that the scaling factor required to maintain good generalization will decrease with qubit count. Initial evidence of this can be glanced from Figs. 3a, wherein the optimized value of the scaling factor decreases slightly for higher qubit count. Since obtaining true scaling of the bandwidth parameter would require experiments with the numbers of qubits far beyond those accessible in simulation, a promising future direction is studying of analytically tractable feature maps and data distributions such as those considered in Ref. [11]. For such problems it may be possible to derive closed-form scaling of optimal bandwidth parameter, as well as establish the scaling of important properties such as the range of parameter values that lead to good generalization.
As shown in Fig. 1b, the Hamiltonian evolution feature map with optimized scaling factor can achieve accuracy approaching that of the best classical model reported in [7]. The improvement in performance with qubit count, observed in the motivating example, is present for all datasets and qubit counts considered. Figure 4 shows prediction accuracy as a function of datapoint dimension, which is equal to the qubit count in the case of the IQP feature map and is equal to (Number of qubits − 1) for the Hamiltonian evolution feature map. With the scaling factor fixed to the optimized value, we observe improvement in performance with growing qubit count up to a certain threshold at which the performance plateaus. The value of the threshold depends on the difficulty of the classification task. For fmnist, considered in [7], the performance stops improving at about 13 qubits, whereas for the more difficult plasticc dataset, considered in [22], the performance improves for the entire range of qubit counts considered, namely, up to 22. Similar to the motivating example, the improvement in performance can be partially attributed to the increased dimensionality of the input datapoint, which allows PCA to preserve more data variance. We note, however, that within the regime considered, no deleterious effects of increased dimensionality of the Hilbert space are observed. The cessation in the performance improvement with qubit count for fmnist can be explained by the model saturating the best possible performance on this problem, as evidenced by it matching the performance of the best known classical methods (see Fig. 1b).

Impact of bandwidth on model generalization and comparison with classical kernels
In the preceding section we showed that the performance of quantum kernel methods is sensitive to quantum kernel bandwidth (scaling factor). This sensitivity is due to how the kernel bandwidth affects the expressivity of the model, which we now explain. We being by noting that the behavior is completely analogous to the variation in the performance of classical kernel methods with kernel bandwidth. The role of kernel bandwidth and its effect on SVC performance are well known in classical machine learning [15,23,24]. To illustrate its effect, we consider the RBF kernel given by ; here the hyperparameter γ controls the bandwidth. Analogously to the case of the quantum feature map we considered above, γ can be subsumed into the definition of input data as a scaling factor. The kernel matrix K ij = k(x i , x j ) is then used in an SVC analogously to the quantum kernel case described above.
If γ is large, the kernel is "narrow," and the SVC with such a kernel can fit any labels, which may lead to overfitting. This is analogous to the scaling factor λ above, where large scaling factor values lead to overfitting. Figure 5 shows overfitting resulting from an overly expressive kernel. For large values of γ or λ, the score on the training set goes to one, and the score on the test set decreases to that of random guessing. On the other hand, for sufficiently small values, the kernel is "wide," and the SVC with such kernel is insufficiently expressive, leading to underfitting. The goal is therefore to identify the bandwidth that makes the model sufficiently but not overly expressive.
To illustrate the effect of quantum kernel bandwidth (controlled by the scaling factor) on the expressiveness of the model, we present two sets of experiments in Fig. 5. We optimize the penalty term C in SVC either using cross-validation or to directly maximize the training score (see Methods for detailed description). When the penalty term that maximizes the training score is chosen, we observe clear under-and overfitting for small and large values of the scaling factor, respectively. Additional information about the performance of the methods without cross-validation is given in the Supplementary Information. In the preceding sections, however, we presented the results with cross-validation since they show slightly better performance. In this case, for the easier fmnist and kmnist datasets, the behavior is similar. For the harder plasticc dataset, the training score for the largest value of the scaling factor λ decreases, thereby indicating the absence of overfitting. We observe that for the plasticc dataset, for both feature maps the cross-validation hyperparameter optimization leads to the smallest possible value C, corresponding to the largest margin at the cost of a lower training score. For this particular dataset, this is sufficient to prevent overfitting. For the other datasets considered, the hyperparameter optimization does not lead to the largest penalty, suggesting that increasing the penalty would not help overcome overfitting.

Effects of limited control precision and finite sampling
So far we have demonstrated that with appropriate bandwidth selection, performance of quantum kernel methods need not deteriorate with the growth in qubit count and can approach the performance of the best classical methods. Two major obstacles arise in realizing the observed performance of quantum models in prac- tice: the errors introduced by finite sampling and the limited precision of controls. We now provide numerical evidence that these obstacles do not prevent realizing the good model performance observed above under realistic assumptions on the number of samples used and the control precision. The first obstacle is that, in practice, the kernel matrix is evaluated by performing measurements of a quantum device, limiting the effective precision with which kernel matrix elements can be evaluated. In general, the errors introduced by the finite sampling statistics need not preclude quantum advantage [6]. For small values of the kernel, however, finite sampling may lead to large relative errors [25] and can potentially nontrivially affect prediction performance. Moreover, the variance of the errors in the value of | 0|ψ | 2 introduced by finite sampling differs depending on the choice of state |ψ , necessitating careful numerical investigation. This can be easily observed by comparing the variance between |ψ = 1 2 n x∈{0,1} n |x and |ψ being an n-qubit GHZ state [26]. To numerically evaluate the effects of finite sampling in a realistic setting, we consider the Hamiltonian evolution feature map with the hyperparameters corresponding to the highest prediction accuracy on the fmnist dataset (n = 19, T = 40). For each value of the scaling factor, we recompute the 5-by-5 subset of the corresponding kernel matrix using 5,000 shots 10 times, and we use the mean of the standard deviations of the submatrix entries as the standard deviation for i.i.d. normal noise with mean zero applied to the full matrix. The noise is applied in a way that preserves the symmetry of the matrix. The resulting matrix may not be positive semi-definite; we take the closest (in Frobenius norm; see, e.g., Ref. [27]) positive semi-definite approximation as the kernel matrix for the SVC. Figure 2d presents the prediction accuracy obtained with the kernel matrix evaluated from full quantum state up to machine precision ("Exact") and with sampling noise ("5k shots"). We observe poor performance in the cases where the nondiagonal kernel matrix values are all close to zero or all close to one (i.e., kernel very narrow or very wide). However, at the same time, when an appropriate kernel bandwidth (equivalent to scaling the data) is chosen, we observe that good performance is recovered. This is due to bandwidth choice preventing the values of the kernel matrix from concentrating; see Fig. 2d, top. This evidence suggests that in some cases judicious choice of bandwidth parameter may reduce the number of samples needed.
The second obstacle is finite precision of controls available on noisy intermediate-scale quantum (NISQ) hardware, which limits the range of values that can be used as inputs to the quantum feature map. This can potentially limit the scaling of the data. Note that this issue is limited to NISQ devices, since fault-tolerant architectures allow synthesis of single-qubit operations with precision matching that of classical machines [28]. To numerically evaluate the effects of finite precision, we recompute the kernel matrix values with parameters rounded to no more than a fixed number of decimals. Figure 2b shows that with the scaling factor that maximizes performance in the full-precision case (0.05), three decimals of precision is sufficient to match the performance of the noiseless case. As the scaling factor decreases, the number of decimals required to match the full precision increases. We note that precision of trapped ion hardware currently available on the cloud (three decimals [29]) is sufficient to saturate the noiseless performance of a scaling factor that is five times smaller than the one maximizing performance at 19 qubits, suggesting that the control precision would not be the limiting factor for the qubit counts expected in the near term.

DISCUSSION
Numerical evaluation of promising quantum algorithms is an essential complement to theoretical analysis. When identifying opportunities and no-go results for quantum advantage, it is therefore crucial to consider all aspects of the quantum algorithm that can be used to boost its performance. In this work we identify quantum kernel bandwidth as the key hyperparameter controlling the expressiveness of the model, with excessively small bandwidth leading to overfitting and large bandwidth leading to underfitting. We show that careful kernel bandwidth selection can mitigate the exponential decay of kernel values with qubit count and avoid overfitting and the corresponding drop-off in prediction accuracy. As a pleasant surprise, we discover that for a given dataset a wide range of bandwidth values work well (this is most clearly visible in Fig. 5). This observation suggests that optimizing kernel bandwidth need not be difficult in practice: finding the correct order of magnitude is often sufficient for achieving good performance.
While the bandwidth hyperparameter we introduce is superficially similar to the rescaling of the data used by Schuld et al. [14] to control the expressive power of parameterised quantum circuits, our perspective differs in two important ways. First, we study the kernel method setting, therefore the expressiveness of the model is controlled by the properties of the kernel matrix: roughly speaking, the closer the kernel matrix is to diagonal, the more expressive the model. As can be glanced from Fig. 5, one consequence of this is that simply increasing the scaling factor leads to more expressive modela drastically different dynamic from the one considered in Ref. [14]. Second, the kernel setting we choose has the attribute that increasing the number of qubits while keeping the feature map fixed implicitly increases the expressiveness of the model. This expressiveness is then modulated by the bandwidth hyperparameter. The setting chosen in Ref. [14] does not have this property, and the authors do not consider explicitly the interplay between the hyperparameters and qubit counts.
Recent proposals to control the inductive bias of quantum kernels by projecting them into a lower-dimensional subspace [7,11] are clearly complementary to the ideas put forward in this work since they attempt to overcome similar challenges. The projection can be straightforwardly combined with bandwidth optimization to more precisely modulate the inductive bias of the model. More interestingly, the projection operation can itself be viewed as a hyperparameter in the absence of sufficient prior knowledge. Such techniques may be required to achieve good performance with qubit counts significantly larger than accessible for study at the time of writing.
In this paper we consider only two hyperparametersscaling factor and the number of Trotter steps in the Hamiltonian evolution feature map. We see a significant effect for only one of them, the scaling factor, which controls the kernel bandwidth. We anticipate that more elaborate feature maps will be explored with potentially more parameters that can be tuned. Doing so may help bridge the gap between fully trainable quantum embeddings [12], which require expensive training on a quantum computer, and fixed feature maps. Careful consideration of hyperparameters of quantum kernels may enable the tuning of the inductive bias of the model in a way that is infeasible classically, providing a potential path to quantum advantage in machine learning.

Data preprocessing
We preprocess the input data in the following way. For fmnist [19], we follow the preprocessing pipeline of [7], which results in the two classes of dresses (class 0) and shirts (class 3). For kmnist [20], we arbitrarily choose class 1 and class 4. For plasticc [21], we use the dataset preprocessed as described in [22], provided by the authors. For all datasets, each datapoint is rescaled such that the mean value is zero and the standard deviation is one. Then, each datapoint (28-by-28 pixel images for fmnist and kmnist and 67-dimensional vector for plasticc) is reduced to the required number of dimensions by using the scikit-learn [30] implementation of PCA. We use 800 randomly selected points as the training set and 200 randomly selected points as the test set. The fmnist and kmnist datasets provide separate training and test sets, and for plasticc we split the dataset into training and testing parts randomly, as stratified by the value of the label. The random splits result in approximately (though not exactly) balanced problems. The same random samples are used for all quantum feature maps and hyperparameter values.
a. Kernel methods The quantum kernels are computed by using Qiskit [31]. For each datapoint x i , we use the Qiskit Aer simulator [31] to compute the vector of amplitudes describing the quantum state of its representation |x i . Then, the values of the kernel k(x i , x j ) = | x i |x j | 2 are obtained by taking inner products of the corresponding vectors of amplitudes. The resulting kernel matrix is used in the scikit-learn [30] implementation of the SVC. Following [7], we perform a grid search over the following values of the penalty term in Eq. 1: For the results presented in Fig. 1b, 5c, we choose the value C that maximizes the training score. In all other plots, we perform 5-fold cross-validation to choose C. In all plots, we report balanced accuracy, defined as the mean recall of the two classes, as the prediction accuracy score.
For the classical RBF kernel k(x i , x j ) = exp(−γ x i − x j 2 ), we begin by performing 5-fold cross-validation over the values of C defined above and the following values of γ: where Var [x] is the variance of the training data and N = 800 is the number of training points. Then, we fix the value of C to the optimized value obtained from the cross-validation, and we vary parameter γ to obtain Fig. 5a. b. Data availability We release all code used to generate the data and the plots, as well as the raw data, online: https://github.com/rsln-s/Importance-of-Kernel-Bandwidth-in-Quantum-Machine-Learning/. Figure 6 illustrates the relationship between model performance and scaling factor for varying levels of the second hyperparameter, namely, the number of Trotter steps T . No significant variation in performance with T is observed. Figure 7 shows the scaling of the kernel for feature maps and datasets not included in the main text. Figures 8 and 9 show results without cross-validation for SVM hyperparameter optimization. Concretely, the penalty term C is optimized to maximize the training score. Figure 8 shows the prediction accuracy change with scaling factor, and Figure 9 shows scaling of prediction accuracy with qubit count for optimized bandwidth.

DISCLAIMER
The opinions, findings, and conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of JPMorgan Chase.   For each qubit count, the value of the scaling factor corresponding to the highest accuracy is highlighted with a purple square. For each model and each dataset considered, a clear "Goldilocks" regime is visible where the scaling factor is neither too small nor too large.