Tanisha Bassan


Quantum Machine Learning

Utilizing Support Vector Machine algorithms on quantum computers for advantageous classification of data and solving complex problems.


Sound extremely intimidating and I have to admit all those words together are pretty scary so I wouldn’t put it past you if you run away.

For those you who are sticking through the whole article (stay strong), I am going to break down and explain this new field in quick steps. My focus is specifically on quantum support vector machines (SVM’s) but there are many other algorithms you can learn about :) Hopefully by the end of this article I will have helped you understand why quantum machine learning will help us tackle extremely hard problems.

In this article, you’ll learn about:

  • What is classical machine learning and it’s limitations
  • Introduction of quantum computing and why it’s important to help accelerate ML
  • How quantum SVM’s work
  • My personal project and code

Classical Machine Learning:

There are three different areas of machine learning: supervised, unsupervised and reinforcement.

In this article we will look into specifically supervised learning, support vector machines fall under this category.

Supervised learning uses a set of labeled data to train a machine learning algorithm to understand a specific task such as classifying between two different objects (cats vs. dogs). A new unknown data point is introduced into the algorithm and based on it’s previous training it has to predict how to classify this new input (whether its a dog or a cat based off its set of different features).

Classical computers are really good at doing classification on 2d planes (classifying between 2 different classes) however this problem becomes too complex to solve when it reaches nth dimensional classifications (classifying between multiple different classes).

Classification in 3d space → hard to do on classical computers as dimensions are scaled higher

Thats why we need…

Quantum Computing

Quantum computers will provide the computational advantage to classify objects in nth dimensions that are extremely hard to scale on classical computers.

They utilize the laws of quantum mechanics, specifically superposition and entanglement to create an unthinkable amount of computational power. Quantum chips are created using that display these properties and are used to map out computer algorithms to solve complex problems.

A specific problem that can be solved using quantum computers and machine learning is designing new chemical compounds.

We can use ML to understand how to classify complex objects such as atoms. Except this is extremely hard to simulate on classical computers because as more atoms are added together to create larger molecules, the in-motion particles become impossible to simulate computationally as the magnitude of interactions grows too complex.

In short quantum machine learning will help boost the computational power to tackle problems that are too complex to solve.

Some areas that we can apply this too are:

  • Understanding nano-particles
  • Material discovery
  • Designing chemicals and drugs
  • Pattern recognition and classification

Areas this can be extremely useful in are:

  • Creating new materials that can be applied in space tech, wearable tech, renewable energy, nanotech, etc.
  • Discovery of new drugs and chemical combinations to tackle incurable diseases
  • Mapping out our brain circuitry
  • Understanding our genetic makeup
  • Building the infrastructure of completely connected security with biometrics and IOT devices
  • New physical discoveries about our universe

Drug discovery, mapping out out brains, decoding all of our genome and the other areas I have listed above are current problems really smart people are working towards solving right now. There are many different methods being used today such as machine learning, advanced security measures and modelling large amounts of datasets. However there is a clear limit as to how much data we can compute on our classical computers and a lot of these problems need large amount computational power (imagine trying to map out trillions of neurons in our brain at the same time!). With quantum machine learning, a lot of unsolved problems now have the infrastructure to support more rigorous data analysis and use ML to teach computers on how to find hidden patterns that humans could have never picked up on.

Support vector machines:

The are supervised learning algorithms used for classification and regression problems. In this case we use them for classification of objects that are too complex for classical computers.

SVM’s can classify objects in the nth-dimensional space where the decision based boundary is calculated using d-1. This means that the hyperplane separating your data will be one dimension lower than the feature space with all data points.

2D Classification with maximized distance between data points (support vectors)

To have the most accurate decision boundary, SVM’s maximize the distance between the two classes of different data points. These data points are also the support vectors, points closest to decision boundary. They can also classify data that is non-linearly separable, meaning it cannot be classified with a simple straight line.

Non-linear relation therefore no hyperplane to separate data accurately

They use a kernel trick to project the data points into much higher dimensions until a linear hyperplane can be found to separate them.

Adding another dimension Z to now see a linear relation that can be classified with a hyperplane

When data points are projected in higher dimensions, it is hard for classical computers to compute through such large computations. Hence with a quantum computer this task can become easy and even the most complex dataset can be computed in extremely high dimensions for accurate classification. This specific algorithm is called Support Vector Machine Quantum Kernel Algorithm. It is just taking the classical ML algorithm and translating it into a quantum circuit so it can be run on a quantum computer efficiently.

An example of a quantum circuit showcasing quantum teleportation

Personal Project: Classification of Cancer Cells

The problem I focused on is classifying if cells are cancerous or not for a specific Breast Cancer dataset. I will apply the support vector machine quantum kernel algorithm to predict the accuracy of well the model works on this dataset and if it can classify accordingly.

How it’s built:

First step is preparing the breast-cancer dataset for the quantum circuit and importing it so the algorithm can be run. The steps are:

  1. Import dataset from sklearn or the dataset can be imported through this website.
  2. Define your variables to include training datasets, testing dataset and how it’s split.
  3. Normalize dataset to have 0 unit variance so the pixels from the images have a very small range and can be computed efficiently.
  4. Using IBM’s qiskit library take your current features of dataset and transform them to the number of qubits.
  5. Set the range for SVM to -1 and +1 so classification can be done based on where a datapoint lies on the range.
  6. Set up the training dataset.
  7. Set up a plot to showcase visually the classification.

Next step is implementing the quantum ML algorithm. IBM has it part of their library which you can easily simulate. The steps are:

  1. Setting up how many qubits your quantum circuit will have.
  2. Defining your classes again and import the dataset which you manipulated above.
  3. Dictating the algorithm and setting its parameters for how many runs it will do and depth of the circuit.
  4. Input the new datapoints
  5. Check for results after the algorithm is finished running.

It will be helpful having the code open to understand these steps better so I will link my github down below.

The results showed that so far quantum computers are able to simulate similar results to a classical computer. The data classification is shown below and the different colors represent whether a datapoint classifies as cancerous or not.


So now the quantum computers have developed enough to start running small QML algorithms and testing for their accuracy. In the next 10 years with our rapidly increasing technology, QML will become a massive field with immense amount of applications. It will help solve the most complex problems in our world today and lead to more powerful AI. Quantum computers will basically put AI on steroids and results could massively impactful.

My goal is to continue preparing for when the hardware is stable enough to run some of these complex problems and find a solution to the world’s hardest problems. Stay connected with me if you would like to learn more about my work or follow my journey!

Thank you for reading, and be sure to check out my other articles as a pre-curser to understanding some of the technical terms mentioned.

Personal website: http://tanishabassan.ca/

Github with link to QML experiment: https://github.com/tanishabassan/Quantum-Machine-Learning

More by Tanisha Bassan

Topics of interest

More Related Stories