Supervised learning with quantum enhanced feature spaces

Vojtech Havlicek, Antonio D. Córcoles, Kristan Temme, Aram W. Harrow, Abhinav Kandala, Jerry M. Chow, Jay M. Gambetta

References

Supplementary Information: Supervised learning with quantum enhanced feature spaces

Consider a classification task on a set C={1,2…c}C=\{1,2\ldots c\} of cc classes (labels) in a supervised learning scenario. In such settings, we are given a training set TT and a test set SS, both are assumed to be labeled by a map m:T∪S→Cm:T\cup S\rightarrow C unknown to the programmer. Both sets SS and TT are provided to the programmer, but the programmer only receives the labels of the training set. So, formally, the programmer has only access to a restriction m∣Tm_{|T} of the indexing map mm:

Description of the Algorithm

We consider two different learning schemes. The first is referred to as “Quantum variational classification”, the second is referred to “Quantum kernel estimation”. Both schemes construct a separating hyperplane in the state space of nn qubits. The classical data is mapped to this space with \mboxdim=4n\mbox{dim}=4^{n} using a unitary circuit family starting from the reference state ∣ 0⟩⟨0 ∣n|\,0\rangle\langle 0\,|^{n}.

For our first classification approach we design a variational algorithm which exploits the large dimensional Hilbert space of our quantum processor to find an optimal cutting hyperplane in a similar vein as Support Vector Machines (SVM) do. The algorithm consists of two main parts: a training stage and a classification stage. For the training stage, a set of labeled data points are provided, on which the algorithm is performed. For the classification stage, we take a different set of data points and run the optimized classifying circuit on them without any label input. Then we compare the label of each data point to the output of the classifier to obtain a success ratio for the data set. For both the training and the classification stages, the quantum circuit that implements the algorithm comprises three main parts: the encoding of the feature map, the variational optimization and the measurement, Fig S1. The training phase consists of these steps.

The classification can be applied when the training phase is complete. The optimal parameters are used to decide the correct label for new input data. Again, the same circuit is applied as in Fig S1, however, this time the parameters are fixed and and the outcomes are combined to determine the label which is reported as output of the classifier.

Quantum kernel estimation

For the second classification protocol, we restrict ourselves to the binary label case, with C={+1,−1}C=\{+1,-1\}. In this protocol we only use the quantum computer to estimate the ∣T∣×∣T∣|T|\times|T| kernel matrix K(x⃗i,x⃗j)=∣⟨ Φ(x⃗i) ∣ Φ(x⃗j) ⟩∣2K(\vec{x}_{i},\vec{x}_{j})=|\left\langle\,\Phi(\vec{x}_{i})\,|\,\Phi(\vec{x}_{j})\,\right\rangle|^{2}. For all pairs of points x⃗i,x⃗j∈T\vec{x}_{i},\vec{x}_{j}\in T in the the training data, we sample the overlap to obtain the matrix entry in the kernel. This output probability can be estimated from the circuit depicted in Fig. S5.b. by sampling the output distribution with RR shots and only taking the 0n0^{n} count. After the kernel matrix for the full training data has been constructed we use the conventional (classical) support vector machine classifier. The optimal hyperplane is constructed by solving the dual problem LDL_{D} in eqn. (6), which is completely specified after we have been given the labels yiy_{i} and have estimated the kernel K(x⃗i,x⃗j)K(\vec{x}_{i},\vec{x}_{j}). The solution of the optimization problem is given in terms of the support vectors NSN_{S} for which αi>0\alpha_{i}>0.

The Relationship of variational quantum classifiers to support vector machines

The references vapnik2013nature ; burges1998tutorial provide a detailed introduction to the construction of support vector machines for pattern recognition. Support vector machines are an important tool to construct classifiers for tasks in supervised learning. We will show that the variational circuit classifier bears many similarities to a classical non-linear support vector machine.

The task in constructing a linear support vector machine (SVM) in this scenario is the following. One is looking for a hyperplane that separates the data, with the largest possible distance between the two separated sets. The perpendicular distance between the plane and two points with different labels is called a margin and such points are referred to as ‘support vectors’. This means that we want to maximize the margin by minimizing ∣∣w∣∣||{\bf w}||, or equivalently ∣∣w∣∣2||{\bf w}||^{2} subject to the constraints as given in eqn. (2), for all data points in the training set TT. The corresponding cost function can be written as:

where αi≥0\alpha_{i}\geq 0 are Lagrange multipliers chosen to ensure the constraints are satisfied.

These slack variables are then used to modify the objective function by 1/2∥w∥2→1/2∥w∥2+C(∑iξi)r+∑iμiξ1/2\|{\bf w}\|^{2}\rightarrow 1/2\|{\bf w}\|^{2}+C(\sum_{i}\xi_{i})^{r}+\sum_{i}\mu_{i}\xi. When we choose r≥1r\geq 1 the optimization problem remains convex and a dual can be constructed. In particular, for r=1r=1, neither the ξi\xi_{i} or their Lagrange multipliers μi\mu_{i} appear in the dual Lagrangian.

It is very helpful to consider the dual of the original primal problem LPL_{P} in eqn. (4). The primal problem is a convex, quadratic programming problem, for which the Wolfe dual cost function LDL_{D} for the Lagrange multipliers can be readily derived by variation with respect to w{\bf w} and bb. The dual optimization problem is

The variables of the primal are given in terms of the dual variables by

and the bias bb can be computed from the Karush-Kuhn-Tucker (KKT) conditions when the corresponding Lagrange multiplier does not vanish. The optimal variables satisfy the KKT conditions and play an important role in the understanding of the SVM. They are given for primal as

Note that the condition eqn. (12) ensures that either the optimal αi=0\alpha_{i}=0 or the corresponding constraint eqn. (12) is tight. This is a property referred to as complementary slackness, and indicates that only the vectors for which the constraint is tight give rise to non-zero αi>0\alpha_{i}>0. These vectors are referred to as the support vectors and we will write NSN_{S} for their index set. The classifier in the dual picture is given by substituting w{\bf w} from eqn. (7) and bb into the classifier eqn. (3). The bias bb is obtained for any i∈NSi\in N_{S} from the equality in eqn. (12).

The method can be generalized to the case when the decision function does depend non-linearly on the data by using a trick from boser1992training and introducing a high-dimensional, non-linear feature map. The data is mapped via

It is important to note that it is in fact not necessary to construct the mapped data Φ(x⃗i)\Phi(\vec{x}_{i}) in H\mathcal{H} explicitly. Both the training data, as well as the new data to be classified enters only through inner products, in both the optimization problem for training, c.f. eqn. (6), as well as in the classifier, eqn. (3). Hence, we can construct the SVM for arbitrarily high dimensional feature maps (Φ,H)(\Phi,\mathcal{H}), if we can efficiently evaluate the inner products Φ(x⃗i)∘Φ(x⃗j)\Phi(\vec{x}_{i})\circ\Phi(\vec{x}_{j}) and Φ(x⃗i)∘Φ(s⃗)\Phi(\vec{x}_{i})\circ\Phi(\vec{s}), for x⃗i∈T\vec{x}_{i}\in T and s⃗∈S\vec{s}\in S. In particular, if we can find a kernel K(x⃗,y⃗)=Φ(x⃗)∘Φ(y⃗)K(\vec{x},\vec{y})=\Phi(\vec{x})\circ\Phi(\vec{y}) that satisfies Mercer’s condition (which ensures that the kernel is positive semi-definite and can be interpreted as matrix of inner products) boser1992training ; vapnik2013nature , we can construct a classifier by setting

Variational circuit classifiers:

where we have defined the diagonal operator

In classification tasks we assign c.f. eqn. (34), the label with the highest empirical weight of the distribution pyp_{y}. We ask whether the outcome +1+1 is more likely than −1-1, or vice versa. That is, we ask, whether p+1>p−1−bp_{+1}>p_{-1}-b or whether the converse is true. This of course depends on the sign of the expectation value ⟨Φ(x⃗) ∣W†(θ,φ)  f  W(θ,φ)∣ Φ(x⃗)⟩\langle\Phi(\vec{x})\,|W^{\dagger}(\theta,\varphi)\;{\bf f}\;W(\theta,\varphi)|\,\Phi(\vec{x})\rangle for the data point x⃗\vec{x}.

To understand how this relates to the SVM in greater detail, we need to choose an orthonormal operator basis, such as for example the Pauli group

This means that both the measurement operator W†(θ) f W(θ)W^{\dagger}(\theta)\,{\bf f}\,W(\theta) in the WW-rotated frame as well as the state ∣ Φ(x⃗)⟩⟨Φ(x⃗) ∣|\,\Phi(\vec{x})\rangle\langle\Phi(\vec{x})\,| can be expanded in terms of the operator basis with only real coefficients as

This expression is identical to the conventional SVM classifier, c.f. eqn. (3), after the feature map has been applied. However, in the experiment we only have access to the probabilities pyp_{y} through estimation. Furthermore, the wα(θ)w_{\alpha}(\theta) are constrained to stem from the observable f{\bf f} measured in the rotated frame.

This means, that the correct feature space, where a linearly separating hyperplane is constructed is in fact the quantum state space of density matrices, and not the Hilbert space H2n\mathcal{H}_{2}^{n} itself. This is reasonable, since the physical states in H2n\mathcal{H}_{2}^{n} are only defined up to a global phase ∣ ψ⟩∼eiη∣ ψ⟩|\,\psi\rangle\sim e^{i\eta}|\,\psi\rangle. The equivalence of states up to a global phase would make it impossible to find a separating hyperplane, since both ∣ ψ⟩|\,\psi\rangle and −∣ ψ⟩-|\,\psi\rangle give rise to the same physical state but can lie on either side of a separating plane.

Encoding of the data using a suitable feature map

The action of the map can be understood by a unitary circuit family denoted by UΦ(x⃗){\cal U}_{\Phi(\vec{x})} that is applied to some reference state, e.g. ∣ 0⟩n|\,0\rangle^{n}. The resulting state is given by ∣ Φ(x⃗)⟩=UΦ(x⃗)∣ 0⟩n|\,\Phi(\vec{x})\rangle={\cal U}_{\Phi(\vec{x})}|\,0\rangle^{n}. The state in the feature space should depend non-linearly on the data. Let us discuss proposals for possible feature maps

There are many choices for the feature map Φ\Phi. Let us first discuss what would happen if we were to choose a feature map that corresponds to a product input state. We assume a feature map, comprised of single qubit rotations U(φ)∈SU(2)U(\varphi)\in\text{SU}(2) on every qubit on the quantum circuit. The angles for every qubit can be chosen as a non-linear function φ:x⃗→(0,2π]2×[0,π]\varphi:\vec{x}\rightarrow(0,2\pi]^{2}\times[0,\pi] into the space of Euler angles for the individual qubits, so that the full feature map can be implemented as:

One example for such an implementation is the unitary implementation of the feature map used in the context of the classical classifiers by Stoudenmire and Schwab stoudenmire2016supervised based on tensor networks. There each qubit encodes a single component xix_{i} of x⃗∈n\vec{x}\in^{n} so that nn qubits are used. The resulting state that that is prepared is then

Non-trivial feature map with entanglement

There are many choices of feature maps, that do not suffer from the malaise of the aforementioned product state feature maps. To obtain an quantum advantage we would like these maps to give rise to a kernel K(x⃗,y⃗)=∣⟨ Φ(x⃗) ∣ Φ(y⃗) ⟩∣2K(\vec{x},\vec{y})=|\left\langle\,\Phi(\vec{x})\,|\,\Phi(\vec{y})\,\right\rangle|^{2} that is computationally hard to estimate up to an additive polynomially small error by classical means. Otherwise the map is immediately amenable to classical analysis and we are guaranteed to have lost any conceivable quantum advantage.

Let us therefore turn to a family of feature maps, c.f. Fig S2 for which we conjecture that it is hard to estimate the overlap ∣⟨ Φ(x⃗) ∣ Φ(y⃗) ⟩∣2|\left\langle\,\Phi(\vec{x})\,|\,\Phi(\vec{y})\,\right\rangle|^{2} on a classical computer. We define the family of feature map circuit as follows

which leaves ∣V∣+∣E∣|V|+|E|, real parameters to encode the data. In particular, we know that we have at least ∣V∣=n|V|=n real numbers to encode the data. Furthermore, depending on the connectivity of the interactions, we have ∣E∣≤n(n−1)/2|E|\leq n(n-1)/2 further parameters that can be used to encode more data or nonlinear relations of the initial data points.

This feature map encodes both the actual function Φx⃗(z)\Phi_{\vec{x}}(z) of the diagonal phases, as well as the corresponding Fourier-Walsh transform Φ^x⃗(p)\hat{\Phi}_{\vec{x}}(p) at z,p∈{0,1}nz,p\in\{0,1\}^{n}

Since we have that the variance of the random variable is bounded by 11 since ∣Φx⃗(z)∣2=1|\Phi_{\vec{x}}(z)|^{2}=1 , we get an additive error that scales as O(ϵ)\mathcal{O}(\epsilon). This means for a single layer, the kernel can be estimated classically.

Quantum variational classification

Following the structure of the feature map circuit, we construct the classifier part of the variational algorithm by appending layers of single-qubit unitaries and entangling gates Fig. S3.a. Each subsequent layer, or depth, contains an additional set of entanglers across all the qubits used for the algorithm. We use a coherently controllable quantum mechanical system, such as for example the superconducting chip with nn transmon qubits to prepare a short depth quantum circuit W(θ⃗)W(\vec{\theta}). In the experiment here, comprising n=2n=2 qubits, one controlled-phase gate is added per depth. The single-qubit unitaries used in the classifier are limited to YY and ZZ rotations to simplify the number of parameters to be handled by the classical optimizer. Our use of controlled-phase, rather than CNOT, gates for the entanglers is justified by our aim at increased generality in our software. Using controlled-phase gates does not require to particularize this part of the algorithm for different systems topologies. A specific entangling map for a given device can then be used by our compiler to translate each controlled-phase gate into the CNOTs available in our system.

The general circuit is comprised of the following sequence of single qubit and multi-qubit gates:

We apply a circuit of ll repeated entanglers as depicted in Fig S3.b and interleave them with layers comprised of local single qubit rotations:

This short-depth circuit can generate any unitary if sufficiently many layers dd are applied. The circuit Fig. S3.a can be understood as a bang-bang controlled evolution of an Ising model Hamiltonian H0=∑(ij)∈EJijZiZjH_{0}=\sum_{(ij)\in E}J_{ij}Z_{i}Z_{j},c.f. Fig. S3.b, interspersed with single qubit control pulses in SU(2)SU(2) on every qubit. It is known that this set of drift steps together with all single control pulses are universal, so we have that any state can be prepared this way with sufficient circuit depth d2007introduction . For a general unitary gate sequence the entangling unitary has to be effectively generated from cross resonance gates, by applying single qubit control pulses.

Choosing the cost-function for the circuit optimization

The central goal is to find an optimal classifying circuit W(θ⃗)W(\vec{\theta}), c..f. eqn. (31) that separates the data sets with different labels. Since we can re-run the same classifying multiple times (RR shots), we may consider a ‘winner takes all’ scenario, where we assign the label according to the outcome with the largest probability. We choose a cost function, so that the optimization procedure minimizes the probability of assigning the wrong label after having constructed the distribution after RR shots.

There are multiple ways of performing a multi-label classification. We only need to modify the final measurement MM, to correspond to multiple partitions. This can be achieved by multiple strategies. For example one could choose to measure again in the computational basis, i.e. the basis in which Pauli ZZ are diagonal and then constructing classical labels form the measured samples, such as a labeling the outcome z∈{0,1}nz\in\{0,1\}^{n} according to a function f:{0,1}n→{1,…,c}f:\{0,1\}^{n}\rightarrow\{1,\ldots,c\}. The resulting {My}y=1,…,c\{M_{y}\}_{y=1,\ldots,c} is therefore diagonal in the computational basis. Alternatively one could construct a commuting measurement akin to the syndrome check measurement for quantum stabilizers. For this approach we choose a set {gi}i=1…⌈log⁡2(c)⌉\{g_{i}\}_{i=1\ldots\lceil{\log_{2}(c)}\rceil} of Pauli matrices gi∈PNg_{i}\in\mathcal{P}_{N} that are commuting [gi,gj]=0[g_{i},g_{j}]=0. The resulting measurement that would need to be performed is similar to that of an error correcting scheme. The measurement operators are given by My=2−1(1−∏i=1⌈log⁡2(c)⌉giyi)M_{y}=2^{-1}\left(1-\prod_{i=1}^{\lceil{\log_{2}(c)}\rceil}g_{i}^{y^{i}}\right). Here yiy^{i} denotes the ii’th bit in the binary representation of yy. In either case, the decision rule that assigns the labels can be written as

This corresponds to taking RR shots in order to estimate the largest outcome probability from the outcome statistics of the measurement MyM_{y} for y=1,…,cy=1,\ldots,c. Labelling TcT_{c} the subset of samples TT labelled with cc, the overall expected misclassification rate is given by:

Binary label classification

Assume the programmer classifies into labels y∈{−1,1}y\in\{-1,1\} by taking RR shots for a single datapoint. She obtains an empirical estimates of probability of the datum being labeled by a label yy

After R=ry+r−yR=r_{y}+r_{-y} shots and a prior bias bb, she misclassifies into a label yy if

The probability of her misclassifying a yy sample according to the argmax rule is hence estimated by

Assuming large RR, computing this exactly may be difficult. Setting Rpy=a,Rpy(1−py)=β2Rp_{y}=a,Rp_{y}(1-p_{y})=\beta^{2} and ⌈(1+yb2)R⌉=γ\lceil\left(\frac{1+yb}{2}\right)R\rceil=\gamma, we can approximate the binomial CDF as an error function:

See Fig. S4. The error function can be consequently approximated with a sigmoid

as an estimate for misclassifying a sample ss. The cost function to optimize is then given by using this in eqn. (35).

For multiple labels, one tries to optimize

We consider the case of three labels. For RR samples with frequencies {n0,n1,n2}\{n_{0},n_{1},n_{2}\}, drawn independently from the output probability distribution, the probability of misclassifying a sample s∈T0s\in T_{0} by argmax is given by

where the last inequality is derived as follows

Hence setting γ=N+∣n1−n2∣3\gamma=\frac{N+|n_{1}-n_{2}|}{3}, it follows that

This however still depends on n1,n2n_{1},n_{2}, which can’t be simply eliminated. Additionally, for a general kk-label case, there is no simple analytic solution for γ\gamma. For this reason, we therefore try to estimate the above probability by simply taking γ=max⁡c′({nc′}c′/c)\gamma=\max_{c^{\prime}}\left(\{n_{c^{\prime}}\}_{c^{\prime}/c}\right). So for kk-label case, the cost function terms are given by

Quantum kernel estimation

For the second classification method we only use the quantum computer to estimate the kernel K(x⃗i,x⃗j)=∣⟨ Φ(x⃗i) ∣ Φ(x⃗j) ⟩∣2K(\vec{x}_{i},\vec{x}_{j})=|\left\langle\,\Phi(\vec{x}_{i})\,|\,\Phi(\vec{x}_{j})\,\right\rangle|^{2} for all the labeled training data x⃗j∈T\vec{x}_{j}\in T. Then we use the classical optimization problem as outlined again in eqn. (6) to obtain the optimal Lagrange multipliers αi\alpha_{i} and support vectors NSN_{S} can be obtained. From this the classifier can be constructed, c.f .eqn. (14). To apply the classifier to a new datum s⃗∈S\vec{s}\in S the kernel K(x⃗i,s⃗)K(\vec{x}_{i},\vec{s}) between s⃗\vec{s} and the support vectors in i∈NSi\in N_{S} has to be estimated. We discuss two methods to estimate this overlap for our setting.

The usual method of estimating the fidelity between two states is by using the swap test buhrman2001quantum . This circuit, however, is not a short depth circuit on a quantum computing architecture with geometrically local gates. It would require a sequence of controlled SWAP, also known as Fredkin gates, all conditioned on the state of the same ancilla qubit. A very nice protocol was recently developed in cincio2018learning . The authors have learned multiple ways of optimizing the conventional swap test. If only the value of the fidelity is needed, as is the case for our algorithm, the authors propose, c.f. cincio2018learning section III.C, a circuit that is constant depth if pairs of CNOT gates can be executed in parallel. This circuit, c.f. Fig S5.a, evaluates the expectation value ⟨ψ ∣⟨ϕ ∣SWAP∣ ψ⟩∣ ϕ⟩\langle\psi\,|\langle\phi\,|\textsf{SWAP}|\,\psi\rangle|\,\phi\rangle directly. The action of the algorithm can be understood as follows:

The SWAP gate is both a unitary gate and a hermitian observable SWAP†=SWAP\textsf{SWAP}^{\dagger}=\textsf{SWAP} with eigenvalues ±1\pm 1. The expectation value on two product states as we said given by ⟨ψ ∣⟨ϕ ∣SWAP∣ ψ⟩∣ ϕ⟩=∣⟨ ϕ ∣ ψ ⟩∣2\langle\psi\,|\langle\phi\,|\textsf{SWAP}|\,\psi\rangle|\,\phi\rangle=|\left\langle\,\phi\,|\,\psi\,\right\rangle|^{2}. Now the gate can be decomposed in to a product of two qubit swap gates SWAP=∏k=1nSWAPsktk\textsf{SWAP}=\prod_{k=1}^{n}\textsf{SWAP}_{s_{k}t_{k}} that act all in parallel. To evaluate the expectation value one has to diagonalize the full gate. This is achieved by diagonalizing the individual two-qubit swap gates by observing that SWAPij=CNOTi→jCNOTj→iCNOTi→j\textsf{SWAP}_{ij}=\textsf{CNOT}_{i\rightarrow j}\textsf{CNOT}_{j\rightarrow i}\textsf{CNOT}_{i\rightarrow j}. Furthermore using the circuit identity CNOTj→i=HjCZjiHj\textsf{CNOT}_{j\rightarrow i}=H_{j}\textsf{CZ}_{ji}H_{j}, we see that SWAPij\textsf{SWAP}_{ij} is diagonalized by CNOTj→iHj\textsf{CNOT}_{j\rightarrow i}H_{j} and has eigenvalue (−1)xixj(-1)^{x_{i}x_{j}}. For the full circuit Fig S5.a one first applies a transversal set of CNOT gates across both registers followed by a single layer of Hadamard gates HH on the top register. Then the output is sampled and the average of the boolean function

is reported. The output bits on the top register are labeled by s∈{0,1}ns\in\{0,1\}^{n}, while t∈{0,1}nt\in\{0,1\}^{n} is the output string on the lower register.

Note that the optimization problem, eqn. (6) is only concave, when the matrix K≥0K\geq 0 is positive semi-definite. It can happen, that the shot noise and other errors in the experiment lead to a K^\hat{K} that is no longer positive semi-definite. We have indeed observed this multiple times in the experiment. A possible way of dealing with this problem is a method developed in smolin2012efficient , where an optimization problem is solved to find the closest positive semi-definite KK-matrix in trace norm to K^\hat{K} consistent with the constraint. In our experiments however, we have found this not to be necessary and the performance has been almost optimal without performing this method.

Device parameters

Our device is fabricated on a 720-μ\mum-thick Si substrate. A single optical lithography step is used to define all CPW structures and the qubit capacitors with Nb. The Josephson junctions are patterned via electron beam lithography and made by double-angle deposition of Al.

The dispersive readout signals are amplified by Josephson Parametric Converters Bergeal2010 (JPC). Both the quantum processor and the JPC amplifiers are thermally anchored to the mixing chamber plate of a dilution refrigerator.

The two qubit fundamental transition frequencies are ωi/2π={5.2760(4),5.2122(3)}\omega_{i}/2\pi=\{5.2760(4),5.2122(3)\} GHz, with anharmonicities Δi/2π={−330.3,−331.9}\Delta_{i}/2\pi=\{-330.3,-331.9\} MHz, where i∈{0,1}i\in\{0,1\}. The readout resonator frequencies used are ωRi/2π={6.530553,6.481651}\omega_{Ri}/2\pi=\{6.530553,6.481651\} GHz, while the CPW bus resonator connecting Q0Q_{0} and Q1Q_{1} was unmeasured and designed to be 7.0 GHz. The dispersive shifts and line widths of the readout resonators are measured to be 2χi/2π={−1.06,−1.02}2\chi_{i}/2\pi=\{-1.06,-1.02\} MHz and κi/2π={661,681}\kappa_{i}/2\pi=\{661,681\} kHz, respectively.

The two qubit lifetimes and coherences were measured intermittently throughout our experiments. The observed mean values were T1(i)={55,38}T_{1(i)}=\{55,38\}, T2(i)∗={16,17}T^{*}_{2(i)}=\{16,17\}, T2(i)echo={43,46}T^{\rm{echo}}_{2(i)}=\{43,46\} μ\mus with i∈{0,1}i\in\{0,1\}

Gate characterization

Our experiments use calibrated X−X-rotations (XπX_{\pi} and Xπ/2X_{\pi/2}) as single-qubit unitary primitives. Y−Y-rotations are attained by appropiate adjustment of the pulse phases, whereas Z−Z-rotations are implemented via frame changes in software mckay2017efficient . A time buffer is added at the end of each physical pulse to mitigate effects from reflections and evanescent waves in the cryogenic control lines and components.

We use two sets of gate times in order to perform the Richardson extrapolation of the noise in our system temme2017error . For the first set of gate times we use 83 ns for single-qubit gates and 333 ns for each cross-resonance pulse. The buffer after each physical pulse is 6.5 ns. The single-qubit gates are gaussian shaped pulses with σ=20.75\sigma=20.75 ns. The cross-resonance gates are flat with turn-on and -off gaussian shapes of σ=10\sigma=10 ns. Our implementation of a CNOT has a duration of two single-qubit pulses and two cross-resonance pulses, giving a total of 858 ns for the first set of gate times, including buffers. For our second set of gate times we use the times of the first set but stretched by a factor of 1.5, including the pulses σ\sigmas and the buffers. This gives a total CNOT time of 1.287 μ\mus and single-qubit gates of ∼125\sim 125 ns.

We experimentally verified our single- and two-qubit unitaries by Randomized Benchmarking (RB) Gambetta2012 ; Corcoles2013 . The following table shows the RB results for all single-qubit gates used in our experiments, including individual and simultaneous RB.

Our two-qubit unitarias are CNOTs constructed from echo cross-resonance sequences Corcoles2013 ; Sheldon2016 . Each of the two cross-resonance pulses in a CNOT has durations of 333 and 500 ns for the two different gate lengths used in our experiments. For our two-qubit RB we obtain a CNOT error of 0.0373±.00150.0373\pm.0015 (0.0636±.00210.0636\pm.0021) for the 333 (500) ns cross-resonance pulse.

Readout correction

Our readout assigned fidelity was ∼95%\sim 95\% for both qubits.

For each experiment, we run 4 (222^{2}) calibration sequences preparing our two qubits in their joint computational states. We gather statistics of these calibrations and create a measurement matrix Aij=P(∣i⟩∣∣j⟩)A_{ij}=P(|i\rangle||j\rangle) where P(∣n⟩∣∣m⟩)P(|n\rangle||m\rangle) is the probability of measuring state ∣m⟩|m\rangle having prepared state ∣n⟩|n\rangle. We then correct the observed outcomes of our experiments by inverting this matrix and multiplying our output probability distributions by this inverse.

Support vectors

Here we show the support vectors and αi\alpha_{i} as calculated for each of the three datasets studied from their KK matrices.

Error mitigation for kernel estimation

The experimental estimation of the kernel matrices shown in Fig. S7 and in Fig. 4 in the main text involves running the experiments at different gate lengths and extrapolating the expectation value of the observable of interest to its zero-noise value. While this technique can be extremely powerful in scenarios where the noise is invariant under time rescaling, it is particularly sensitive to measurement sampling noise. In many cases it is the experimental readout assignment fidelity that determines the bound on how precisely the observable can be estimated.

Even though for our Sets I and II we attain 100 % classification success over 10 randomly drawn test sets in each case, we can quantify how close our experimentally determined separating hyperplane is to the ideal.

The optimal hyperplane for a given training set can be expressed as the linear combination ∑iαiyix⃗i=w\sum_{i}\alpha_{i}y_{i}\vec{x}_{i}={\bf w} (eqn. 7), where w\bf{w} is a vector orthogonal to the optimal separating hyperplane and x⃗i\vec{x}_{i} are the support vectors. We can therefore quantify the distance between the experimentally obtained hyperplane and the ideal hyperplane by calculating the inner product ⟨w,wideal⟩=∑i∈NS∑j∈NS′yiyjαi∗αj∣⟨x⃗ix⃗j⟩∣2/∣∣w∣∣∣∣wideal∣∣\langle{\bf{w}},{\bf{w}_{\textrm{ideal}}}\rangle=\sum_{i\in N_{S}}\sum_{j\in N_{S}^{\prime}}y_{i}y_{j}\alpha_{i}^{*}\alpha_{j}|\langle\vec{x}_{i}\vec{x}_{j}\rangle|^{2}/||\bf{w}||||\bf{w}_{\textrm{ideal}}|| where NSN_{S} and NS′N_{S}^{\prime} are the sets of experimentally obtained and ideal support vectors, respectively.

In Fig. S8 we show the inner products between the ideal and all experimental hyperplanes, including the two sets of gate times used throughout our experiments, c1c1 and c1.5c1.5, as well as the error-mitigated hyperplanes.

For Sets I and II, which classify at 100 % success, it is clear that error mitigation improves our results very significantly. This is not the case for Set III, which classifies at 94.75 % success. In fact, for Set III we see that error-mitigation worsens the hyperplane, as the results are closer to the ideal for the unmitigated experiments than both Sets I and II.

A look at the calibration data taken along the direct kernel estimation experiments for each set, we see that the readout assignment fidelities of Q0Q_{0}(Q1Q_{1}) are 96.56% (96.31%) for Set I, 95.90% (96.36%) for Set II, and 93.99% (95.47%) for Set III. The slightly worse readout fidelities for Set III could partially explain the worse classification results for this set, but other aspects of the protocol might also contribute to this, like for example some gates operating on a somewhat non-linear regime after the calibrations in this set.

Another symptom for the degree of classification success in a given set can be observed by looking at the combined weight of negative eigenvalues in the kernel matrix, ∑ki<0∣ki∣\sum_{k_{i}<0}|k_{i}|, with kik_{i} the eigenvalues of the kernel. We obtain 1.40, 1.27 and 2.41 for Sets I, II, and III, respectively.