I'm working on QSVM to know the difference between SVM and QSVM. How much better quantum machine learning can do when compared to classical machine learning algorithms?

Part of my code:

backend = BasicAer.get_backend('qasm_simulator', hub=None)
quantum_instance = QuantumInstance(backend, shots=1024, seed=seed, 
result = qsvm.run(quantum_instance) 
print("test accuracy: ", result['testing_accuracy'])

With the above code, I can get the accuracy of the test.

I'm trying to know whether I can draw a decision boundary and classify results from QSVM just like how classical SVM does.


    dict_keys(['svm', 'kernel_matrix_testing', 'test_success_ratio', 'kernel_matrix_training', 'testing_accuracy'])

print (result['svm'].keys())

    dict_keys(['bias', 'alphas', 'support_vectors', 'yin'])

Given only these are the keys that result has, how can I look at QSVM results into two classes graphically? I could get the prediction results though! my new_test_data= 2d array to classify between these two classes : good=1/ bad=0

predictions = qsvm.predict(new_test_data,quantum_instance)
    [1 0 0 0 0 0 0 0 1 1 0 1 1 0 1 0]

Given I don't see how get decision function and be able to plot decision boundary and margins? Like this as we do in classical SVM:

Any help in clarifying how to read the results to plot a graph like this from running QSVM would be much appreciated.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.