-
Notifications
You must be signed in to change notification settings - Fork 377
ValueError in qp_solver.py #1334
Comments
This has been noticed recently that with some sizes of data the optimization that is done in qp_solver can fail and that is the result. We are thinking of adding some additional regularization term that allows the optimization a better chance of success. It has worked for the data sets and sizes we tried. Until that is added my only suggestion would be to try a different size for a your data set - for instance we saw cases where 42 would work, 43 would fail as above, and 44 would work. |
Thank you for your quick reply. I will try that. |
@woodsp-ibm I have tried different dataset sizes, but none of them worked. Is there anything else I could do? Should I do something different if the dataset is nonlinear separable? |
I mentioned that we were thinking of adding an additional regularization term which solves the problem on the data sets that we have tried. It would mean replacing the qp_solver.py in your installation with an updated version that I could point you at - it is being worked on for a PR to Aqua to address this and was still being tested. Would you like to give this a try? Alternatively if the data set you are using is publicly available it maybe something we can check out to ensure it works too. |
Yes, please point me to the new version. |
Ok, here is the updated file. It has a lambda2 value in there which defaults to 0.001. Hopefully it works with the default value but if not just try changing it a little bit bigger. We are working to expose this via QSVM so in practice it will be easier to set. But for now I think this should be ok to test things. Let us know how you get on with it https://github.com/sternparky/qiskit-aqua/blob/QSVM_update_Reg_Rotation/qiskit/aqua/utils/qp_solver.py |
Thank you for the link! I will keep you updated. |
@Supers25 Any update - did that help? As you can see a PR has been created that links to this issue. The PR locally fixes thing for the datasets we had seen the solver error but I was holding off merging to see if it solved things for you too. If so I will change the PR to have it auto-close this issue when it get merged. |
Thank you for checking in. The training is still running. I will keep you posted. |
@woodsp-ibm It worked. Thank you for your help. |
Great, thanks for the update. I'll approve the PR so the fix can be merged and be part of a future release. |
I have been trying to train a qsvm with my own dataset. But It returns this ValueError from qp_slover.py
ValueError: cannot reshape array of size 1 into shape (1614,1)
I have tried to run the model with different feature_maps, but the problem persists. Would you please tell me what the issue could be and how to solve it?
The text was updated successfully, but these errors were encountered: