I am new to Quantum ML, and I am currently using PennyLane to do the QML activity.
As per this article, total number of features is equal to the total number of qubits. (In the example, they have considered Iris dataset. And as we know Iris dataset has only 4 features) In my case I have more than 800+ features, and I want to use all of them for prediction.
When I am trying to pass all my data as per the above article, I am getting the below error.
n_qubits = len(X_train[0]) #896 is the output of this step
dev_kernel = qml.device("default.qubit", wires=0)
projector = np.zeros((2**n_qubits, 2**n_qubits))
projector[0, 0] = 1
@qml.qnode(dev_kernel)
def kernel(x1, x2):
"""The quantum kernel."""
#AngleEmbedding(x1, wires=range(n_qubits))
#qml.adjoint(AngleEmbedding)(x2, wires=range(n_qubits))
#return qml.expval(qml.Hermitian(projector, wires=range(n_qubits)))
AngleEmbedding(x1, wires=range(4))
qml.adjoint(AngleEmbedding)(x2, wires=range(4))
return qml.expval(qml.Hermitian(projector, wires=range(4)))
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Input In [22], in <cell line: 3>()
1 dev_kernel = qml.device("default.qubit", wires=0)
----> 3 projector = np.zeros((2**n_qubits, 2**n_qubits))
4 projector[0, 0] = 1
6 @qml.qnode(dev_kernel)
7 def kernel(x1, x2):
ValueError: Maximum allowed dimension exceeded
If I am changing the value back to 4 (to check the error and functioning of wires), I am getting the below error.
ValueError: Features must be of length 4 or less; got length 896.
Can anyone please help me to proceed further. I want to use all my features to create quantum circuit(s). How can I embed all these 896 features with in the available quantum circuits/dimensions.
Thanks in advance!