1

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)?

Tristan Nemoz
  • 8,429
  • 3
  • 11
  • 39
ZFC
  • 11
  • 1

1 Answers1

1

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.

FDGod
  • 2,901
  • 2
  • 6
  • 31
Steve Wood
  • 1,683
  • 6
  • 5