# How to convert classical machine learning dataset to quantum dataset?

I'm looking for a way to convert images dataset to quantum dataset format to apply some quantum machine learning algorithms. Is it possible?

I have read about that and I found it is possible by using TensorFlow. So, how can I convert my image dataset or tabular (numeric or categorical) dataset to a quantum dataset? To apply some quantum machine learning algorithms or classical deep learning networks.

Is there a tool or GitHub package or even python code to do that?

• Hi and welcome to Quantum Computing SE. I am afraid that under current state of development you would not be able to work with real-world data. The main issues are missing qRAM, know number of qubits in current QPUs and the fact that the quits are too noisy. Oct 29, 2022 at 15:53
• @MartinVesely Thank you ... now everything makes sense. I looked for it and I found some algorithms such as CNN can be used with quantum (namely, QCNN). However, classical algorithms still perform better accuracy, prediction, classification, and detection. Especially in the case of images and this is due to quantum ML algorithms require to downscaling images which hides a lot of details and lowers the feature extractor's performance. Oct 29, 2022 at 21:35

Not specifically for images, but on a general way, Quantum Embedding is the concept what you are looking for:

"A quantum embedding represents classical data as quantum states in a Hilbert space via a quantum feature map."

Reference here.

The process of converting classical data to quantum states can be done using a few different techniques. For instance, Penny Lane will give you:

1. Basis Encoding and
2. Amplitude encoding.

You have a few other options such as Product Encoding, Angle Encoding, etc.

Here is a great article with the theoretical background.

In Qiskit you could use ZZFeatureMap and here is an example of how to do it:

# construct QNN
qc = QuantumCircuit(2)
feature_map = ZZFeatureMap(2)
ansatz = RealAmplitudes(2)
qc.compose(feature_map, inplace=True)
qc.compose(ansatz, inplace=True)
qc.draw(output="mpl")