current years, quantum computing has attracted rising curiosity from researchers, companies, and the general public. “Quantum” has turn into a buzzword that many use to draw consideration. As this area has gained recognition, quantum machine studying (QML) has emerged as an space the place quantum computing and machine studying meet.
As somebody with an curiosity in machine studying and a deep love for math and quantum computing, I discovered the idea of quantum machine studying very interesting. However as a researcher within the area, I used to be additionally considerably skeptical concerning the near-term functions of QML.
As we speak, machine studying powers instruments comparable to advice techniques and medical diagnostics by discovering patterns in information and making predictions. Quantum computing, in distinction, processes data in another way by leveraging results comparable to superposition and entanglement.
The sector of quantum machine studying explores this chance and seeks to reply this query.
Can quantum computer systems assist us study from information extra successfully?
Nonetheless, as with something associated to quantum computing, it’s vital to set clear expectations. Quantum computer systems at the moment are defective and incapable of operating large-scale packages. That being stated, they’re able to offering a proof of idea on the utility of QML in varied functions.
Furthermore, QML isn’t meant to interchange classical machine studying. As a substitute, it appears to be like for elements of the educational course of the place quantum techniques would possibly supply a bonus, comparable to information illustration, exploring complicated function areas, or optimization.
With that in thoughts, how can a knowledge scientist or a machine studying engineer dip their toe within the pool that’s QML? Any machine studying algorithm (quantum or classical) requires information. Step one is all the time information preparation and cleansing. So, how can we put together the info to be used in a QML algorithm?
This text is all about QML workflows and information encoding.
Quantum Machine Studying Workflows
Earlier than we soar into information, let’s take a fast pause and briefly outline what quantum machine studying is. At a excessive stage, quantum machine studying refers to algorithms that use quantum techniques to carry out machine studying duties, together with:
1. Classification
2. Regression
3. Clustering
4. Optimization
Most approaches in the present day fall into what we name hybrid quantum-classical fashions, during which classical computer systems deal with information enter and optimization, whereas quantum circuits are a part of the mannequin.
A useful means to consider that is: Classical machine studying focuses on designing options, whereas quantum machine studying typically focuses on encoding options into quantum states.
Since information can take many kinds, QML workflows could look completely different relying on the kind of enter and algorithm.
If we’ve got classical information and a classical algorithm, that’s our typical machine studying workflow. The opposite three choices are the place issues get considerably fascinating.
1. Quantum Knowledge with a Quantum Mannequin (Totally Quantum)
Essentially the most easy method is to have some quantum information and use it with a quantum mannequin. In idea, what would this workflow appear to be?
1- Quantum Knowledge Enter: The enter is already a quantum state: ∣ψ⟩
2- Quantum Processing: A circuit transforms the state: U(θ)∣ψ⟩
3- Measurement
The information we’re working with would possibly come from:
1. A quantum experiment (e.g., a bodily system being measured).
2. A quantum sensor.
3. One other quantum algorithm or simulation.
As a result of the info is already quantum, there isn’t a want for an encoding step. At a conceptual stage, that is the “purest” type of quantum machine studying, so we’d anticipate the strongest type of quantum benefit right here!
However, this workflow remains to be restricted in apply attributable to some challenges, together with:
1. Entry to Quantum Knowledge: Most real-world datasets (pictures, textual content, tabular information) are classical. Actually, quantum information is way tougher to acquire.
2. State Preparation and Management: Even with quantum information, making ready and sustaining the state ∣ψ⟩ with excessive constancy is difficult attributable to noise and decoherence.
3. Measurement Constraints: Whereas we delay measurement till the tip, we nonetheless face limitations, comparable to we solely extract partial data from the quantum state, and we want cautious design of observables.
In one of these workflow, the objective is to study immediately from quantum techniques.
2. Quantum Knowledge with Classical Algorithms
Up to now, we’ve got centered on workflows during which quantum information is utilized in a quantum system. However we must also take into account the state of affairs the place we’ve got quantum information, and we wish to use it with a classical ML algorithm.
At first look, this looks as if a pure extension. If quantum techniques can generate wealthy, high-dimensional information, why not use classical machine studying fashions to research it?
In apply, this workflow is possible, however with an vital limitation.
A quantum system is described by a state comparable to:
which accommodates exponentially many amplitudes. Nonetheless, classical algorithms can not immediately entry this state. As a substitute, we should measure the system to extract classical data, for instance, by expectation values:
These measured portions can then be used as options in a classical mannequin.
The problem is that measurement essentially limits the quantity of knowledge we will extract. Every measurement offers solely partial details about the state, and recovering the total state would require an impractical variety of repeated experiments.
That being stated, classical machine studying can play a worthwhile position in analyzing noisy measurement information, figuring out patterns, or bettering sign processing.
Therefore, most quantum machine studying approaches purpose to maintain information within the quantum system for so long as potential—bringing us again to the central problem of this text:
How will we encode classical information into quantum states within the first place?
So, let’s speak concerning the remaining workflow.
3. Classical Knowledge with a Quantum Mannequin (Hybrid QML)
That is the most typical workflow used in the present day. Principally, it’s a mannequin the place we encode classical information into quantum states after which apply QML to acquire outcomes. Hybrid QML algorithms like this have 5 steps:
1- Classical Knowledge Enter
Knowledge begins in a well-known kind:
2- Encoding Step
The information is mapped right into a quantum state:
3- Quantum Processing
A parameterized circuit processes the info:
4- Measurement
Outcomes are extracted as expectation values:
5- Classical Optimization Loop
Parameters θ are up to date utilizing classical optimizers.
This workflow brings a brand new problem that isn’t present in classical machine studying:
How will we effectively encode classical information right into a quantum system?
That’s what we’ll reply subsequent!

Classical Knowledge Encoding
If we step again and evaluate these workflows, one factor turns into clear: the principle structural distinction is the encoding step.
As a result of most real-world functions use classical datasets, this step is normally vital. So, how will we signify classical information in a quantum system?
In classical computing, information is saved as numbers in reminiscence.
In quantum computing, information should be represented as a quantum state:
For a number of qubits:
The place: are complicated amplitudes . So, in easy phrases, encoding means: Taking classical information and mapping it into the amplitudes, phases, or rotations of a quantum state.
Now, let’s take a deeper take a look at the various kinds of information encoding.
1. Foundation Encoding (Binary Mapping)
That is the only method to encoding classical information. Principally, we signify classical binary information immediately as qubit states.
Qiskit Instance
from qiskit import QuantumCircuit
qc = QuantumCircuit(3)
qc.x(0) # 1
qc.x(2) # 1
qc.draw('mpl')

Right here, every bit maps on to a qubit, and no superposition is used. This method solely works if the dataset we’re utilizing is straightforward. and it’s normally utilized in demonstrations and educating reasonably than precise implementation of QML.
In one of these information encoding, you would wish one qubit per function, which doesn’t scale properly to bigger, extra sensible issues.
2. Angle Encoding
To have a richer encoding, as a substitute of turning values into 0 or 1, we use rotations to encode our classical information. Quantum information will be rotated in three instructions, X, Y, and Z.
In angle encoding, we take a classical function x and map it onto a quantum state utilizing a rotation:
, the place α∈{x, y, z}.
So in precept, you should use Rx(x), Ry(x), or Rz(x).
However not all of them encode information in the identical means. Generally, Rx or Ry is used for information encoding.
Qiskit Instance
from qiskit import QuantumCircuit
import numpy as np
x = [0.5, 1.2]
qc = QuantumCircuit(2)
qc.ry(x[0], 0)
qc.ry(x[1], 1)
qc.draw('mpl')

Angle encoding can, in precept, be carried out utilizing rotations about any axis (e.g., Rx, Ry, Rz). Nonetheless, rotations concerning the Y- and X-axes immediately have an effect on measurement chances, whereas Z-rotations encode data in part and require further operations to turn into observable.
Once we use rotation to encode information, steady information are dealt with naturally, leading to a compact illustration that’s straightforward to implement. By itself, this methodology is usually linear except we add entanglement.
3. Amplitude Encoding
That is the place issues begin to really feel “quantum.” In amplitude encoding, the info is encoded into the amplitudes of a quantum state.
With n qubits, we will encode values, which implies we get exponential compression.
Qiskit Instance
from qiskit import QuantumCircuit
from qiskit.quantum_info import Statevector
import numpy as np
x = np.array([1, 1, 0, 0])
x = x / np.linalg.norm(x)
qc = QuantumCircuit(2)
qc.initialize(x, [0,1])
qc.draw('mpl')

The problem with this method is that state preparation is dear (circuit-wise), which may make circuits deep and noisy. So, though amplitude encoding appears highly effective in idea, it’s not all the time sensible with present {hardware}.
4. Function Maps (Larger-Order Encoding)
Up to now, we’ve principally simply loaded classical information into quantum states. Function maps go a step additional by introducing nonlinearity, capturing function interactions, and leveraging entanglement.
The construction of this encoding would appear to be:
Which means options don’t simply act independently; they work together with one another.
Qiskit Instance
from qiskit import QuantumCircuit
x1, x2 = 0.5, 1.0
qc = QuantumCircuit(2)
qc.ry(x1, 0)
qc.ry(x2, 1)
qc.cx(0, 1)
qc.rz(x1 * x2, 1)
qc.draw('mpl')

Any such encoding is the quantum equal of polynomial options or kernel transformations. This lets the mannequin discover complicated relationships within the information.
You may consider function maps as reworking information into a brand new area, a lot as kernels do in classical machine studying. As a substitute of mapping information right into a higher-dimensional classical area, QML maps it right into a quantum Hilbert area.

Ultimate Ideas
Though quantum computer systems will not be absolutely there, hardware-wise, there’s a lot we will do with them in the present day. One of the crucial promising functions of quantum computer systems is quantum machine studying. If there’s one thought value holding onto from this text, it’s this:
In quantum machine studying, the way you encode the info typically issues as a lot because the mannequin you’re utilizing.
This may appear stunning at first, but it surely’s truly much like classical machine studying. The distinction is that in QML, encoding isn’t simply preprocessing; it’s a part of the mannequin itself.
And, identical to the broader area of quantum computing, this space remains to be growing. We don’t but know the “finest” encoding methods. The {hardware} constraints form what’s sensible in the present day, and new approaches are nonetheless being explored.
So when you’re seeking to get into quantum computing, quantum machine studying is without doubt one of the most impactful locations to start out. Not by leaping straight into complicated algorithms, however by beginning with a a lot less complicated query: How can my information work together with a quantum system?
Answering that query permits us to totally make the most of the facility of the quantum computer systems we’ve got in the present day.
References & Additional Studying
- Schuld, M., & Petruccione, F. (2018). Supervised studying with quantum computer systems (Vol. 17, p. 3). Berlin: Springer.
- Havlíček, V., Córcoles, A. D., Temme, Ok., Harrow, A. W., Kandala, A., Chow, J. M., & Gambetta, J. M. (2019). Supervised studying with quantum-enhanced function areas. Nature, 567(7747), 209-212.
- Qiskit Documentation: https://qiskit.org/documentation/
- Schuld, M., & Killoran, N. (2019). Quantum machine studying in function Hilbert areas. Bodily Overview Letters, 122(4), 040504.

