0

I was trying to execute the following code in IBM QE (implementing a QSVM based classifier)

feature_dim = 2 feature_map = ZZFeatureMap(feature_dimension=feature_dim, reps=2, entanglement='linear') qsvm = QSVM(feature_map, training_input, test_input)

backend = BasicAer.get_backend('qasm_simulator') quantum_instance = QuantumInstance(backend, shots=1024, seed_simulator=seed, seed_transpiler=seed)

result = qsvm.run(quantum_instance)

print(f'Testing success ratio: {result["testing_accuracy"]}')

I get the following error :

Traceback (most recent call last): Input In [18] in <cell line: 8> result = qsvm.run(quantum_instance) File /opt/conda/lib/python3.8/site-packages/qiskit/aqua/algorithms/quantum_algorithm.py:71 in run return self._run() File /opt/conda/lib/python3.8/site-packages/qiskit/aqua/algorithms/classifiers/qsvm/qsvm.py:476 in _run return self.instance.run() File /opt/conda/lib/python3.8/site-packages/qiskit/aqua/algorithms/classifiers/qsvm/_qsvm_binary.py:135 in run self.train(self._qalgo.training_dataset[0], self._qalgo.training_dataset[1]) File /opt/conda/lib/python3.8/site-packages/qiskit/aqua/algorithms/classifiers/qsvm/_qsvm_binary.py:82 in train [alpha, b, support] = optimize_svm(kernel_matrix, labels, scaling=scaling, lambda2=lambda2) File /opt/conda/lib/python3.8/site-packages/qiskit/aqua/utils/qp_solver.py:93 in optimize_svm prob.solve(verbose=show_progress, qcp=True) File /opt/conda/lib/python3.8/site-packages/cvxpy/problems/problem.py:473 in solve return solve_func(self, *args, **kwargs) File /opt/conda/lib/python3.8/site-packages/cvxpy/problems/problem.py:945 in _solve raise error.DQCPError("The problem is not DQCP.") DQCPError: The problem is not DQCP.

Use %tb to get the full traceback.

Is this because of deprecated packages like in the case of aqua, also the qiskit tutorials on QSVMs (both binary and multi-classifier ) are missing. Could someone help me out ? Much thanks

1 Answers1

0

Qiskit Aqua was deprecated, as you have seen, and is no longer supported.

I would suggest looking at the equivalent function in Qiskit Machine Learning where all the ML related function from Aqua was moved/refactored. There is a tutorial here showing kernel based algorithms https://qiskit.org/documentation/machine-learning/tutorials/03_quantum_kernel.html Here the QSVM is now called QSVC and extends sklearn SVC.

Steve Wood
  • 266
  • 1
  • 3