This device is not compatible.

PROJECT

# Create a Classical-Quantum KNN Classifier Using Qiskit

Implement the KNN algorithm from scratch using quantum computing. Get an overview of the quantum computing concepts required to implement the project.

You will learn to:

Create and simulate a quantum circuit using Qiskit.

Encode classical data on quantum circuits.

Implement a quantum computing algorithm from scratch.

Leverage the quantum advantage for a machine learning problem.

Skills

Quantum Computing

Quantum Algorithms

Quantum Machine Learning

Prerequisites

Hands-on experience with Python

Basic understanding of quantum computing

Basic understanding of machine learning

Intermediate understanding of linear algebra

Hands-on experience with Qiskit

Technologies

NumPy

Qiskit

Pandas

seaborn

Scikit-learn

Project Description

The $k$ nearest neighbor (KNN) classification is a supervised machine learning algorithm used to classify a sample based on the sample(s) nearest to it.

Qiskit is an open-source quantum computing software development kit (SDK) by IBM Quantum. One of the most popular quantum-computing SDKs, Qiskit allows gate-based implementation of quantum circuits. Moreover, Qiskit has dedicated frameworks for specific applications like finance and simulations.

In this project, weâ€™ll implement a quantum algorithm to perform KNN classification. To achieve this objective, weâ€™ll first create a quantum circuit on which the quantum KNN algorithm will be executed. After that, weâ€™ll encode the dataset to the quantum circuit. Then, weâ€™ll simulate the quantum circuit on a simulator and extract the $k$ nearest neighbor from the simulation results.

Project Tasks

1

Getting Started

Task 0: Project Overview

Task 1: Import Libraries

2

Data Preprocessing

Task 2: Import the Dataset

Task 3: Plot the Dataset

Task 4: Normalize the Dataset

Task 5: Split the Dataset

3

Data Encoding

Task 6: Understand the Encoding Technique

Task 7: Encode the Test Vector

Task 8: Encode the Training Data

Task 9: Create a Superposition of the Training Vectors

4

Creation of the Quantum Circuit

Task 10: Create the Quantum Registers

Task 11: Add the Registers to the Quantum Circuit

Task 12: Initialize the Quantum Registers

Task 13: Apply the Quantum SWAP Test to the Quantum Circuit

Task 14: Measure the Qubits

5

Simulation and Postprocessing

Task 15: Execute the Quantum Circuit

Task 16: Decode the Simulation Results

Task 17: Evaluate the Distances of the Training Samples

Task 18: Find k Nearest Neighbors

Task 19: Determine the Model Accuracy

Congratulations!