If you’re using quantum machine learning to look at classical data and solve machine learning problems, then you need to see how to represent this classical data as a quantum state. When you use a quantum device to solve some machine learning problem, it deals with the quantum state, so this data has to be somehow mapped to a quantum state.
There are many ways to do embedding, but we will only be discussing the following:
For basis embedding, the data must be in the form of a binary string. The concept of basis embedding is based on the use of a computational basis. A scalar value is approximated to its binary form before being transformed into a quantum state. For example, y=010 represents a 3-qubit quantum state, you can see this in the diagram.
There are real input values in amplitude embedding. For example, data point y
has four dimensions (for instance, ). We require two qubits for these four features in y
. Normalize this input and then directly encode it into the amplitude of our quantum states.
Take a look below for the general formula:
is the jth element of y. We have to square-normalize each element. For example, (1.2,2.7,1.1,0.5) and is the computational basis state.
The final form is:
Suppose we have a y
data point with two features: y1
and y2
.
These features will become the angle of your rotation in angle embedding. Each of the features use the two qubits separately.
y1
can be encoded on the first qubit as:
y2
can be encoded on the second qubit as:
The rotations can be performed on either , , or axis of the Bloch sphere.