1
$\begingroup$

I'm following this tutorial to try and implement a QSVC on the Iris dataset. The tutorial uses ZZFeatureMap to create the kernel with FidelityQuantumKernel, but I want to try and use different feature maps (such as the ones described in Section III in this). However, I'm unable to implement such feature maps. I tried, for example:

feature_map = RawFeatureVector(X_train.shape[1])

but when I train the SVC it says

QiskitError: 'Cannot define a ParameterizedInitialize with unbound parameters'

How can I implement feature maps to create kernels as

kernel = FidelityQuantumKernel(fidelity=fidelity, feature_map=feature_map)?

$\endgroup$

1 Answer 1

1
$\begingroup$

RawFeatureVector is not built into a circuit until it's passed parameters. The FidelityQuantumKernel uses a Fidelity which tries to compose the feature_map, the RawFeaturevector in your example, with its inverse(). Since this circuit is not yet defined, this fails and leads to the above error.

Now, you can define your own feature map and pass it in a QuantumCircuit representing that. But the RawFeatureVector is more of a special case.

$\endgroup$
1
  • $\begingroup$ Any hint on how to to that? I need to implement Amplitude Encoding (that's why I was trying to use RawFeatureVector). $\endgroup$
    – ZFC
    Mar 30 at 16:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.