Quantum Perceptron Models

02/15/2016 ∙ by Nathan Wiebe, et al. ∙ 0

We demonstrate how quantum computation can provide non-trivial improvements in the computational and statistical complexity of the perceptron model. We develop two quantum algorithms for perceptron learning. The first algorithm exploits quantum information processing to determine a separating hyperplane using a number of steps sublinear in the number of data points N, namely O(√(N)). The second algorithm illustrates how the classical mistake bound of O(1/γ^2) can be further improved to O(1/√(γ)) through quantum means, where γ denotes the margin. Such improvements are achieved through the application of quantum amplitude amplification to the version space interpretation of the perceptron model.



There are no comments yet.


page 1

page 2

page 3

page 4

This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

I Introduction

Quantum computation is an emerging technology that utilizes quantum effects to achieve significant, and in some cases exponential, speed-ups of algorithms over their classical counterparts. The growing importance of machine learning has in recent years led to a host of studies that investigate the promise of quantum computers for machine learning 

Aïmeur et al. (2006); Lloyd et al. (2013); Wiebe et al. (2015); Lloyd et al. (2014); Rebentrost et al. (2014); Wiebe & Granade (2015); Wiebe et al. (2014); Amin et al. (2016).

While a number of important quantum speedups have been found, the majority of these speedups are due to replacing a classical subroutine with an equivalent albeit faster quantum algorithm. The true potential of quantum algorithms may therefore remain underexploited since quantum algorithms have been constrainted to follow the same methodology behind traditional machine learning methods Garnerone et al. (2012); Wiebe et al. (2014); Amin et al. (2016). Here we consider an alternate approach: we devise a new machine learning algorithm that is tailored to the speedups that quantum computers can provide.

We illustrate our approach by focusing on perceptron training Rosenblatt (1958)

. The perceptron is a fundamental building block for various machine learning models including neural networks and support vector machines 

Suykens & Vandewalle (1999). Unlike many other machine learning algorithms, tight bounds are known for the computational and statistical complexity of traditional perceptron training. Consequently, we are able to rigorously show different performance improvements that stem from either using quantum computers to improve traditional perceptron training or from devising a new form of perceptron training that aligns with the capabilities of quantum computers.

We provide two quantum approaches to perceptron training. The first approach focuses on the computational aspect of the problem and the proposed method quadratically reduces the scaling of the complexity of training with respect to the number of training vectors. The second algorithm focuses on statistical efficiency. In particular, we use the mistake bounds for traditional perceptron training methods and ask if quantum computation lends any advantages. To this end, we propose an algorithm that quadratically improves the scaling of the training algorithm with respect to the margin between the classes in the training data. The latter algorithm combines quantum amplitude estimation in the version space interpretation of the perceptron learning problem. Our approaches showcase the trade-offs that one can consider in developing quantum algorithms, and the ultimate advantages of performing learning tasks on a quantum computer.

The rest of the paper is organized as follows: we first cover the background on perceptrons, version space and Grover search. We then present our two quantum algorithms and provide analysis of their computational and statistical efficiency before concluding.

Ii Background

ii.1 Perceptrons and Version Space

Given a set of separable training examples with corresponding labels , , the goal of perceptron learning is to recover a hyperplane

that perfectly classifies the training set 

Rosenblatt (1958). Formally, we want such that for all . There are various simple online algorithms that start with a random initialization of the hyperplane and make updates as they encounter more and more data Rosenblatt (1958); Li et al. (2002); Gentile (2002); Shalev-Shwartz & Singer (2005); however, the rule that we consider for online perceptron training is, upon misclassifying a vector , .

A remarkable feature of the perceptron model is that upper bounds exist for the number of updates that need to be made during this training procedure. In particular, if the training data is composed of unit vectors, , that are separated by a margin of then there are perceptron training algorithms that make at most mistakes Novikoff (1963), independent of the dimension of the training vectors. Similar bounds also exist when the data is not separated Freund & Schapire (1999) and also for other generalizations of perceptron training Li et al. (2002); Gentile (2002); Shalev-Shwartz & Singer (2005). Note that in the worst case, the algorithm will need to look at all points in the training set at least once, consequently the computation complexity will be .

Our goal is to explore if the quantum procedures can provide improvements both in terms of computational complexity (that is better than ) and statistical efficiency (improve upon . Instead of solely applying quantum constructs to the feature space, we also consider the version space interpretation of perceptrons which leads to the improved scaling with .

Figure 1: Version space and feature space views of classification. This figure is from (Minka, 2001).

Formally, version space is defined as the set of all possible hyperplanes that perfectly separate the data: . Given a training datum, the traditional representation is to depict data as points in the feature space and use hyperplanes to depict the classifiers. However, there exists a dual representation where the hyperplanes are depicted as points and the data points are represented as hyperplanes that induce constraints on the feasible set of classifiers. Figure 1, which is borrowed from Minka (2001), illustrates the version space interpretation of perceptrons. Given three labeled data points in a 2D space, the dual space illustrates the set of normalized hyperplanes as a yellow ball with unit radius. The third dimension corresponds to the weights that multiply the two dimensions of the input data and the bias term. The planes represent the constraints imposed by observing the labeled data as every labeled data renders one-half of the space infeasible. The version space is then the intersection of all the half-spaces that are valid. Naturally, classifiers including SVMs Suykens & Vandewalle (1999) and Bayes point machines Herbrich et al. (1999) lie in the version space.

We note that there are quantum constructs such as Grover search and amplitude amplification which provide non-trivial speedups for the search task. This is the main reason why we resort to the version space interpretation. We can use this formalism to simply pose the problem of determining the separating hyperplane as a search problem in the dual space. For example given a set of candidates hyperplanes, our problem reduces to searching amongst the sample set for the classifier that will successfully classify the entire set. Therefore training the perceptron is equivalent to finding any feasible point in the version space. We describe these quantum constructs in detail below.

ii.2 Grover’s Search

Both quantum approaches introduced in this work and their corresponding speed-ups stem from a quantum subroutine called Grover’s search Grover (1996); Boyer et al. (1996), which is a special case of a more general method referred to as amplitude amplification Brassard et al. (2002)

. Rather than sampling from a probability distribution until a given marked element is found, the Grover search algorthm draws only one sample and then uses quantum operations to modify the distribution from which it sampled. The probability distribution is rotated, or more accurately the quantum state that yields the distribution is rotated, into one whose probability is sharply concentrated on the marked element. Once a sharply peaked distribution is identified, the marked item can be found using just one sample. In general, if the probability of finding such an element is known to be

then amplitude amplification requires operations to find the marked item with certainty.

Figure 2: A geometric description of the action of on an initial state vector .

While Grover’s search is a quantum subroutine, it can in fact be understood using only geometric arguments. The only notions from quantum mechanics used are those of the quantum state vector and that of Born’s rule (measurement). A quantum state vector is a complex unit vector whose components have magnitudes that are equal to the square–roots of the probabilities. In particular, if is a quantum state vector and is the corresponding probability distribution then


where the unit column vector is called the quatum state vector which sits in the vector space , is the Hadamard (pointwise) product and is the complex conjugate transpose. A quantum state can be measured such that if we have a quantum state vector and a basis vector then the probability of measuring is , where

denotes the inner product. One of the main differences between quantum and classical distributions is that the probability distribution resulting from measurement depends strongly on the basis in which the vector is measured. This basis dependence of measurement is the root of many of the differences between quantum and classical probability theory and also gives rise to many celebrated results in the foundations of quantum mechanics such as Bell’s theorem 

Bell (1964).

At first glance, introducing the quantum state vector may not seem to provide any advantages over working with for the purposes of sampling. More careful consideration reveals that the fact that is complex valued allows transformations on to be performed that cannot be performed on . In particular, we can reflect the quantum state vector about any axis, whereas we cannot do the same to without violating its positivity. Grover’s search, in fact, is a cunning way to perform a series of reflections on to bias towards the marked state we wish to find. While such reflections may not make sense from a classical perspective, quantum computers can be used to realize them efficiently.

The key feature of a quantum computer is that it permits any unitary transformation to be performed on the unit vector , within arbitrarily small approximation error. We define the initial quantum state vector to be and define to be a projection matrix onto a set of configurations that we want to find. In particular, if we define to be the set of all items that we want the quantum algorithm to find then


Here being able to apply does not imply that is known. Instead, it implies that a subroutine that checks to see if exists. The fact that

is implemented by a linear transformation of the state vector also allows it to be simultaneously applied to exponentially many

via . These two features allow a single application of to be efficiently applied, assuming membership in can be efficiently tested, even though is a sum of exponentially many basis vectors.

In order to perform the search algorithm we need to implement two unitary operations:


The operators and can be interpreted geometrically as reflections within a two–dimensional space spanned by the vectors and . If we assume that and then these two reflection operations can be used to rotate in the space . Specifically this rotation is . Its action is illustrated in Figure 2. If the angle between the vector and is , where . It then follows from elementary geometry and the rule for computing the probability distribution from a quantum state (known as Born’s rule) that after iterations of Grover’s algorithm the probability of measuring a desirable outcome is


It is then easy to see that if and a probability of success greater than is desired then suffices to find a marked outcome. This is quadratically faster than is possible from statistical sampling which requires samples on average.

As an example, if the initial success probability is then . Therefore if we take then . As a result a desirable outcome can be found after only quantum operations whereas samples from the initial distribution would be needed on average to find a marked outcome if quantum methods were not used.

If on the other hand, the success probability were then and for all . This problem can be easily addressed by doing something that would not make any sense classically: purposefully lowering the success probability to by requiring a new event where we define to be a good state if the independent variables is good and is . The independence assumption means that the probability that both conditions are satisfied is and hence a good can be found with certainty by applying amplitude amplification on . More generally, if is known then this trick can be applied to make (for positive integer ) which makes the search procedure deterministic.

On the other hand, if is not known then it isn’t clear how should be chosen to make the success probability greater than . Fortunately, methods are known to deal with such issues Boyer et al. (1996); Brassard et al. (2002). The simplest one exploits the fact that the average of over a range of can be easily computed:


If then it is straight forward to see that


The average probability is then guaranteed to be at least if is chosen to be drawn uniformly from if . If a lower bound on is known a good sample can be drawn, then an appropriate value of can be computed.

If no lower bound on is known then a marked element can nonetheless be found with high probability by exponential searching. Exponential searching involves, for step taking for some . After a logarithmic number of applications of amplitude amplification it will attain with high probability. After which the average success probability is known to be bounded below by and the algorithm will succeed with high probability in a constant number of attempts. Thus the quadratic speedup holds even if the success probability is not known apriori.

Iii Online quantum perceptron

Now that we have discussed Grover’s search we turn our attention to applying it to speed up online perceptron training. In order to do so, we first need to define the quantum model that we wish to use as our quantum analogue of perceptron training. While there are many ways of defining such a model but the following approach is perhaps the most direct. Although the traditional feature space perceptron training algorithm is online Novikoff (1963), meaning that the training examples are provided one at a time to it in a streaming fashion, we deviate from this model slightly by instead requiring that the algorithm be fed training examples that are, in effect, sampled uniformly from the training set. This is a slightly weaker model, as it allows for the possibility that some training examples will be drawn multiple times. However, the ability to draw quantum states that are in a uniform superposition over all vectors in the training set enables quantum computing to provide advantages over both classical methods that use either access model.

We assume without loss of generality that the training set consists of unit vectors, . If we then define to be the basis vectors whose indices each coincide with a -bit representation of the corresponding where is the class assigned to and let be a fixed unit vector that is chosen to represent a blank memory register.

We introduce the vectors to make it clear that the quantum vectors states used to represent training vectors do not live in the same vector space as the training vectors themselves. We choose the quantum state vectors here to occupy a larger space than the training vectors because the Heisenberg uncertainty principle makes it much more difficult for a quantum computer to compute the class that the perceptron assigns to a training vector in such cases.

For example, the training vector can be encoded as an unsigned integer , which in turn can be represented by the unit vector . More generally, if were a vector of floating point numbers then a similar vector could be constructed by concatenating the binary representations of the floating point numbers that comprise it with and express the bit string as an unsigned integer, . The integer can then be expressed as a unit vector . While encoding the training data as an exponentially long vector is inefficient in a classical computer, it is not in a quantum computer because of the quantum computer’s innate ability to store and manipulate exponentially large quantum state vectors.

Any machine learning algorithm, be it quantum or classical, needs to have a mechanism to access the training data. We assume that the data is accessed via an oracle that not only accesses the training data but also determines whether the data is misclassified. To clarify, let be an orthonormal basis of quantum state vectors that serve as addresses for the training vectors in the database. Given an input address for the training datum, the unitary operations and allow the quantum computer to access the corresponding vector. Specifically, for all


Given an input address vector , the former corresponds to a database access and the latter inverts the database access.

Note that because and are linear operators we have that . A quantum computer can therefore access each training vector simultaneously using a single operation, while only requiring enough memory to store one of the . The resultant vector is often called in the physics literature a quantum superposition of states and this feature of linear transformations is referred to as quantum parallelism within quantum computing.

The next ingredient that we need is a method to test if the perceptron correctly assigns a training vector addressed by a particular . This process can be pictured as being performed by a unitary transformation that flips the sign of any basis-vector that is misclassified. By linearity, a single application of this process flips the sign of any component of the quantum state vector that coincides with a misclassified training vector. It therefore is no more expensive than testing if a given training vector is misclassified in a classical setting. We denote the operator, which depends on the perceptron weights , and require that


where is a Boolean function that is if and only if the perceptron with weights misclassifies training vector . Since the classification step involves computing the dot–products of finite size vectors, this process is efficient given that the are efficiently computable.

We apply in the following way. Let be a unitary operation such that


is easy to implement in the quantum computer using a multiply controlled phase gate and a quantum implementation of the perceptron classification algorithm, . We can then write

  for  do
     for  do
        Draw uniformly from .
        Prepare quantum state .
        Measure , assume outcome is .
        if  then
        end if
     end for
  end for
Algorithm 1 Online quantum perceptron training algorithm

Classifying the data based on the phases (the minus signs) output by naturally leads to a very memory efficient training algorithm because only one training vector is ever stored in memory during the implementation of given in (10). We can then use to perform Grover’s search algorithm, by taking and with , to seek out training vectors that the current perceptron model misclassifies. This leads to a quadratic reduction in the number of times that the training vectors need to be accessed by or its classical analogue.

In the classical setting, the natural object to query is slightly different. The oracle that is usually assumed in online algorithms takes the form where


We will assume that a similar function exists in both the classical and the quantum settings for simplicity. In both cases, we will consider the cost of a query to to be proportional to the cost of a query to .

We use these operations in Algorithm 1 to implement a quantum search for training vectors that the perceptron misclassifies. This leads to a quadratic speedup relative to classical methods as shown in the following theorem.

Theorem 1.

Given a training set that consists of unit vectors that are separated by a margin of in feature space, the number of applications of needed to infer a perceptron model, , such that using a quantum computer is where

whereas the number of queries to needed in the classical setting, , where the training vectors are found by sampling uniformly from the training data is bounded by

We assume in Theorem 1 that the training data in the classical case is accessed in a manner that is analogous to the sampling procedure used in the quantum setting. If instead the training data is supplied by a stream (as in the standard online model) then the upper bound changes to because all training vectors can be deterministically checked to see if they are correctly classified by the perceptron. A quantum advantage is therefore obtained if .

In order to prove Theorem 1 we need to have two technical lemmas (proven in the appendix). The first bounds the complexity of the classical analogue to our training method:

Lemma 1.

Given only the ability to sample uniformly from the training vectors, the number of queries to needed to find a training vector that the current perceptron model fails to classify correctly, or conclude that no such example exists, with probability is at most .

The second proves the correctness of Algorithm 1 and bounds the complexity of the algorithm:

Lemma 2.

Assuming that the training vectors are unit vectors and that they are drawn from two classes separated by a margin of in feature space, Algorithm 2 will either update the perceptron weights, or conclude that the current model provides a separating hyperplane between the two classes, using a number of queries to that is bounded above by with probability of failure at most .

After stating these results, we can now provide the proof of Theorem 1.

  • Proof of Theorem 1.

    The upper bounds follow as direct consequences of Lemma 2 and Lemma 1. Novikoff’s theorem Novikoff (1963); Freund & Schapire (1999) states that the algorithms described in both lemmas must be applied at most times before finding the result. However, either the classical or the quantum algorithm may fail to find a misclassified vector at each of the steps. The union bound states that the probability that this happens is at most the sum of the respective probabilities in each step. These probabilities are constrained to be , which means that the total probability of failing to correctly find a mistake is at most if both algorithms are repeated times (which is the worst case number of times that they need to be repeated).

    The lower bound on the quantum query complexity follows from contradiction. Assume that there exists an algorithm that can train an arbitrary perceptron using query operations. Now we want to show that unstructured search with one marked element can be expressed as a perceptron training algorithm. Let be a known set of perceptron weights and assume that the perceptron only misclassifies one vector . Thus if perceptron training succeeds then the value of can be extracted from the updated weights. This training problem is therefore equivalent to searching for a misclassified vector. Now let where is a unit vector that represents the bit string and is a Boolean function. Assume that and if , which is without loss of generality equivalent to Grover’s problem Grover (1996); Boyer et al. (1996). Now assume that is assigned to class and take . This perceptron therefore misclassifies and no other vector in the training set. Thus updating the weights yields , which in turn yields the value of such that , and therefore Grover’s search reduces to perceptron training.

    Since Grover’s search reduces to perceptron training in the case of one marked item the lower bound of queries for Grover’s search Boyer et al. (1996) applies to perceptron training. Since we assumed that perceptron training requires queries this is a contradiction. Thus the true lower bound must be .

    We have assumed that in the classical setting that the user only has access to the training vectors through an oracle that is promised to draw a uniform sample from . Since we are counting the number of queries to it is clear that in the worst possible case that the training vector that the perceptron makes a mistake on can be the last unique value sampled from this list. Thus if the query complexity were there would be a contradiction, hence the query complexity is classically.

Iv Quantum version space perceptron

The strategy for our quantum version space training algorithm is to pose the problem of determining a separating hyperplane as search. Specifically, the idea is to first generate sample hyperplanes

from a spherical Gaussian distribution

. Given a large enough , we are guaranteed to have at least one hyperplane amongst the samples that would lie in the version space and perfectly separate the data. As discussed earlier Grover’s algorithm can provide quadratic speedup over the classical search consequently the efficiency of the algorithm is determined by . Theorem 2 provides an insight on how to determine this number of hyperplanes to be sampled.

Theorem 2.

Given a training set that consists of -dimensional unit vectors with labels that are separated by a margin of in feature space, then a -dimensional vector sampled from perfectly separates the data with probability .

The proof of this theorem is provided in the supplementary material. The consequence of Theorem 2 stated below is that the expected number of samples , required such that a separating hyperplane exists in the set, only needs to scale as . Thus if amplitude amplification is used to boost the probability of finding a vector in the version space then the resulting quantum algorithm will need only quantum steps on average.

Next we show how to use Grover’s algorithm to search for a hyperplane that lies in the version space. Let us take , for positive integer . Then given be the sampled hyperplanes, we represent to be vectors that encode a binary representation of these random perceptron vectors. In analogy to , we also define to be a vector that represents an empty data register. We define the unitary operator to generate these weights given an address vector using the following


In this context we can also think of the address vector, , as representing a seed for a pseudo–random number generator that yields perceptron weights .

Also let us define the classical analogue of to be which obeys . Now using (and applying the Hadamard transform Nielsen & Chuang (2010)) we can prepare the following quantum state


which corresponds to a uniform distribution over the randomly chosen


Now that we have defined the initial state, , for Grover’s search we need to define an oracle that marks the vectors inside the version space. Let us define the operator via


This unitary operation looks at an address vector, , computes the corresponding perceptron model , flips the sign of any component of the quantum state vector that is in the half space in version space specified by and then uncomputes . This process can be realized using a quantum subroutine that computes , an application of and and also the application of a conditional phase gate (which is a fundamental quantum operation that is usually denoted Nielsen & Chuang (2010).

The oracle  does not allow us to directly use Grover’s search to rotate a quantum state vector that is outside the version space towards the version space boundary because it effectively only checks one of the half–space inequalities that define the version space. It can, however, be used to build an operation, , that reflects about the version space:


The operation can be implemented using applications of as well as a sequence of elementary quantum gates, hence we cost a query to as queries to .

  for  do
     for  do
        Draw uniformly from .
        Prepare quantum state .
        Measure , assume outcome is .
        if  for all  then
        end if
     end for
  end for
Algorithm 2 Quantum version space perceptron training algorithm

We use these components in Algorithm 2 to, in effect, amplify the margin between the two classes from to . We give the asymptotic scaling of this algorithm in the following theorem (see appendix for proof).

Theorem 3.

Given a training set that consists of unit vectors that are separated by a margin of in feature space, the number of queries to needed to infer a perceptron model with probability at least , , such that is in the version space using a quantum computer is where


The proof of the theorem follows directly from bounds on and the validity of Algorithm 2. It is clear from previous discussions that Algorithm 2 carries out Grover’s search, but instead of searching for a that is misclassified it instead searches for a in version space. Its validity therefore follows by following the exact same steps followed in the proof of Lemma 2 but with . However, since the algorithm need is not repeated times in this context we can replace with in the proof. Thus if we wish to have a probability of failure of at most then the number of queries made to is in

This also guarantees that if any of the vectors are in the version space then the probability of failing to find that vector is at most .

Next since one query to is costed at queries to the query complexity (in units of queries to ) becomes . The only thing that then remains is to bound the value of needed.

The probability of finding a vector in the version space is from Theorem 2. This means that there exists such that the probability of failing to find a vector in the version space times is at most


Thus this probability is at most for


It then suffices to pick for the algorithm.

The union bound implies that the probability that either none of the vectors lie in the version space or that Grover’s search failing to find such an element is at most . Thus it suffices to pick and to ensure that the total probability is at most . Therefore the total number of queries made to is in as claimed. ∎

The classical algorithm discussed previously has complexity , which follows from the fact (proven in the appendix) that suffices to make the probability of not drawing an element of the version space at most . This demonstrates a quantum advantage if , and illustrates that quantum computing can be used to boost the effective margins of the training data. Quantum models of perceptrons therefore not only provide advantages in terms of the number of vectors that need to be queried in the training process, they also can make the perceptron much more perceptive by making training less sensitive to small margins.

These performance improvements can also be viewed as mistake bounds for the version space perceptron. The inner loop in Algorithm 2 attempts to sample from the version space and then once it draws a sample it tests it against the training vectors to see if it errs on any example. Since the inner loop is repeated times, the maximum number of misclassified vectors that arises from this training process is from Theorem 2 which, for constant , constitutes a quartic improvement over the standard mistake bound of  Novikoff (1963).

V Conclusion

We have provided two distinct ways to look at quantum perceptron training that each afford different speedups relative to the other. The first provides a quadratic speedup with respect to the size of the training data. We further show that this algorithm is asymptotically optimal in that if a super–quadratic speedup were possible then it would violate known lower bounds for quantum searching. The second provides a quadratic reduction in the scaling of the training time (as measured by the number of interactions with the training data) with the margin between the two classes. This latter result is especially interesting because it constitutes a quartic speedup relative to the typical perceptron training bounds that are usually seen in the literature.

Perhaps the most significant feature of our work is that it demonstrates that quantum computing can provide provable speedups for perceptron training, which is a foundational machine learning method. While our work gives two possible ways of viewing the perceptron model through the lens of quantum computing, other quantum variants of the perceptron model may exist. Seeking new models for perceptron learning that deviate from these classical approaches may not only provide a deeper understanding of what form learning takes within quantum systems, but also may lead to richer classes of quantum models that have no classical analogue and are not efficiently simulatable on classical hardware. Such models may not only revolutionize quantum learning but also lead to a deeper understanding of the challenges and opportunities that the laws of physics place on our ability to learn.

Appendix A Proofs

Here we provide proofs of several of our results stated in the main body. In particular, we give the proofs of Theorem 2, Lemma 1 and Lemma 2 here.

  • Proof of Theorem 2.

    Given that the margin of the training set if there exist a hyperplane such that for all . If be a sample from , then lets first compute what is the probability that perturbing the maximum margin classifier by amount would lead still lead to a perfect separation. If we consider a data point that lies on the margin, i.e. , we are interested in the probability that and . The first inequality corresponds to preventing misclassification of , while the second one corresponds to preventing misclassification of the point belonging to the other class and on the margin. This is same as asking what is the probability that:


    Let us define . Since and we can show that . Thus, we can write the probability that as:



    is the error function for the standard normal distribution. Since

    is on the margin, the probability that the sample will lie in the version space can be simply characterized as the above probability . It is straightforward to show using Maclaurin series expansion that:


    Note, that in our case are unit normalized for all , thus . Which in turn implies that most of the higher order terms will be close to zero in the limit of small and:


    which proves our theorem for . ∎

  • Proof of Lemma 1.

    There exists a simple algorithm for achieving this upper bound. Draw samples from the set of training vectors. If any are misclassified perform the update, otherwise report that the model classifies all the data.

    The proof of validity of this algorithm is trivial and the success probability claim is also quite simple. Given that we draw samples from the distribution the probability that any of them fail to detect a mistake, given such a mistake exists, is at most


    If we want this error to be at most then it suffices to take


    One query to is required per , which means that is also equal to the query complexity. Thus if at least one mistake occurs then the algorithm will find it with the aforementioned probability if . If such an example does not exist, then the algorithm will correctly conclude that a separating hyperplane has already been found. Therefore in either case the success probability is at least as required. ∎

  • Proof of Lemma 2.

    In order to see this, let us first examine the inner loop of Algorithm 2, which involves performing the update . We know from our discussion of Grover’s algorithm in the main body that if we define the initial probability of successfully find a mistake to be then the probability of finding a such that after updates is . Since this corresponds to finding a vector that the perceptron fails to classify properly, these steps amplify the probability of finding a perceptron error. The query to that follows identifying the index of this training vector then converts this result into a classical bitstring that can then be used to perform a perceptron update. Therefore the inner loop performs a perceptron update with probability using queries to .

    Under the assumption that the next loop repeats this sampling process until in order to ensure that the probability of finding a misclassified element is at least  Brassard et al. (2002)

    . This can be seen using the following argument. First we need to show that the exponential search heuristic requires

    queries. Each iteration of the middle loop requires requires a number of queries that is at most proportional to . Therefore the total number of queries is at most proportional to


    Given is a constant we have that and thus from (4) in the main body. If there exists an element that the algorithm makes a mistake on then because the lowest probability of success corresponds to the case where there is only one training vector that is misclassified out of . From this we see that, if a misclassified vector exists, then the middle loop is repeated at least times which means that the final iteration taken corresponds to for the purposes of (6) in the main body. Therefore, under these assumptions, the probability that the middle loop updates the perceptron weights is at least from Brassard et al. (2002). Given that a mistake exists to be found the middle loop outputs such an element with a probability of failure that is at most from (6) in the main body. Furthermore, queries to are required by the inner loop.

    The outer loop serves to amplify the success probability to at least from the (average) success probability for , which is at least , given that the perceptron makes a mistake on at least one training vector Brassard et al. (2002). Let us assume that we repeat the middle loop of Algorithm 1 times past this point and terminate searching for a marked state if the probability of failing to detect the element is at most . Since the probability of the middle loop failing to find such an element, given that it exists, is at most the probability of failing to find a marked state all times is at most which implies that it suffices to choose


    Given this error bound, the number of Grover iterations needed for the algorithm to find the marked element is

    The result then follows by taking . Therefore the lemma holds if .

    If then the algorithm will never find a quantum state vector that the perceptron misclassifies and will successfully conclude that there is not a marked state after queries. Therefore the lemma also holds in the trivial case. ∎