Skip to content
This repository has been archived by the owner on Dec 7, 2021. It is now read-only.

Fix QSVM problem wit non-positive semi-definite kernel matrices #1190

Merged
merged 27 commits into from
Sep 2, 2020

Conversation

stefan-woerner
Copy link
Contributor

Summary

Noisy estimation of the kernel matrix in QSVM can lead to non positive semi-definite matrices, which cause the convex solver to fail.
Thus, this change replaces the resulting kernel matrix by the closest PSD approximation.

Fixes #1106,
Fixes Qiskit/qiskit-tutorials#932

@woodsp-ibm
Copy link
Member

Will you add a test case, that is like the tutorial which exposed this issue, so we will have this aspect covered now by testing (which was not the case up until now it seems) in case anything arises in the future.

@stefan-woerner stefan-woerner changed the title [WIP] Fix QSVM problem wit non-positive semi-definite kernel matrices Fix QSVM problem wit non-positive semi-definite kernel matrices Aug 27, 2020
@grossiM
Copy link

grossiM commented Aug 31, 2020

Hello,
I am trying this modification using the simple updated tutorial: https://github.com/Qiskit/qiskit-tutorials/blob/master/legacy_tutorials/aqua/machine_learning/qsvm_classification.ipynb

I notice that everything works fine using Python 3.7.7 BUT using the newest python 3.8.5 only the jupyter version of this code is working. If I run it as a code, the qsvm.run instance create n subprocesses of the same instances going into a endless loop...the code recall itself....

@woodsp-ibm woodsp-ibm merged commit 2291596 into qiskit-community:master Sep 2, 2020
@woodsp-ibm woodsp-ibm added the Changelog: Bugfix Include in the Fixed section of the changelog label Sep 2, 2020
@woodsp-ibm woodsp-ibm added this to the 0.8 milestone Sep 2, 2020
pbark pushed a commit to pbark/qiskit-aqua that referenced this pull request Sep 16, 2020
…it-community#1190)

* Update _qsvm_binary.py

* move psd approx to static method for kernel matrix creation

* only apply PSD approximation for symmetric matrices

* remove `print(mat)` from qsvm.py `get_kernel_matrix`

* Add unit test to check enforce_psd

Co-authored-by: Manoel Marques <Manoel.Marques@ibm.com>
Co-authored-by: woodsp <woodsp@us.ibm.com>
Co-authored-by: Steve Wood <40241007+woodsp-ibm@users.noreply.github.com>
Co-authored-by: Julien Gacon <gaconju@gmail.com>
@stefan-woerner stefan-woerner deleted the qsvm_fix branch October 3, 2020 11:24
manoelmarques added a commit to qiskit-community/qiskit-machine-learning that referenced this pull request Feb 27, 2021
…it-community/qiskit-aqua#1190)

* Update _qsvm_binary.py

* move psd approx to static method for kernel matrix creation

* only apply PSD approximation for symmetric matrices

* remove `print(mat)` from qsvm.py `get_kernel_matrix`

* Add unit test to check enforce_psd

Co-authored-by: Manoel Marques <Manoel.Marques@ibm.com>
Co-authored-by: woodsp <woodsp@us.ibm.com>
Co-authored-by: Steve Wood <40241007+woodsp-ibm@users.noreply.github.com>
Co-authored-by: Julien Gacon <gaconju@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Changelog: Bugfix Include in the Fixed section of the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

qsvm.run raises DQCPError Fix for DCPError gives DQCPError now
5 participants