Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] initial version of classifier and regressor #13

Merged
merged 114 commits into from
Mar 30, 2021

Conversation

beichensinn
Copy link
Contributor

Summary

Details and comments

@CLAassistant
Copy link

CLAassistant commented Mar 16, 2021

CLA assistant check
All committers have signed the CLA.

@stefan-woerner stefan-woerner changed the title initial version of classifier and regressor [WIP] initial version of classifier and regressor Mar 16, 2021
@woodsp-ibm
Copy link
Member

Please make sure all files here have the required copyright header in them - this includes the init files too.

from ...exceptions import QiskitMachineLearningError


class Loss(ABC):
Copy link
Member

@woodsp-ibm woodsp-ibm Mar 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need a whole package for one file. If these were all in separate files I could see it. But with everything in one file I would have a thought a loss_functions.py file directly in utils would have sufficed. Unless there is some view to future expansion that would see more coming to this loss_functions folder.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. it is our plan to add more loss in this folder.

stefan-woerner added a commit to stefan-woerner/qiskit-machine-learning that referenced this pull request Mar 30, 2021
Copy link
Contributor

@stefan-woerner stefan-woerner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@adekusar-drl adekusar-drl merged commit 720cfc7 into qiskit-community:master Mar 30, 2021
gentinettagian pushed a commit to gentinettagian/qiskit-machine-learning that referenced this pull request Dec 14, 2021
* initial version of classifier and regressor

* update structure

* fix l1 and l2 losses

* clean imports

* add `dense` to QNNs and update NNClassifier/Regressor

* shelved changes

* batching

* more on batching

* more on batching

* more on batching

* consistent batching

* some spelling

* add copyright

* some docstrings.

* fix some lint errors

* add unit tests and fix output shape

* fix circuit qnn tests

* fix typing

* fix typing

* more batching

* more batching

* Update circuit_qnn.py

* Update opflow_qnn.py

* use sparse probability gradients in case of sample based evaluation

* update neural network classifier

* fix style/spelling/mypy

* fix tests

* Update neural_network_classifier.py

* more batching

* removed duplicate code

* gradients reshaping and more tests.

* fix circuit QNN tests

* fix typing

* add batching logic to `sample()`, `probabilities()`, and `probability_gradients()`

* fix lint

* add gradients for circuit QNN classification + tests

* add initial draft for VQC

* gradient tests.

* add tests with cross entropy

* fix lint, style, mypy

* cross_entropy gradient added

* add cross entropy test with gradients

* fix style, spell

* removed _sample double definition

* make a clean git mv instead of just renaming (1)

* make a clean git mv instead of just renaming (2)

* add vqc + test

* update vqc and tests

* update tutorials

* cross_entropy sigmod, softmax, softmax_stable added

* cross_entropy sigmod, softmax, softmax_stable added

* cross_entropy sigmod added to NN classifier

* cross_entropy and sigmod_cross_entropy has been changed to "CrossEntryLoss" and "CrossEntropySigmodLoss" in both classifier and regression; initial version of NN regressor

* fix loss + minor changes

* revert changes in raw_feature_vector as non-required.

* minor fixes

* Update 02_neural_network_classifier_and_regressor.ipynb

* Update 02_neural_network_classifier_and_regressor.ipynb

* use given gradient in circuit qnn

* remove double output_shape handling

* style, lint

* update tutorial to use regressor

* fix mypy

* merged with new RawFeatureVector, some tests fail

* fix test randomness, disable some of test_raw_feature_vector

* One hot encoding has been removed from NNregression

* randomness, tests

* fix tutorial

* fix tutorial

* fix vqc test with bfgs and qasm simulator

* fix raw feature vector tests

* import fix

* Update 02_neural_network_classifier_and_regressor.ipynb

* test neural network regressor

* 1) 1 bug in NNregressor has been fixed
2) add VQR

* revert notebook to python 3

* 1. VQR updated with TwoLayerQNN
2. fit, predict and score functions were removed from VQR

* new readme test, fix style, lint

* updated vqc notebook, refactored readme test

* update circuit QNN to remove final circuit measurements for gradient

* remove old tutorials

* update TwoLayerQNN and VQR to use default feature map and var form

* update init files

* update NNC/NNR tutorial (02)

* update vqc and vqr

* Update 02_neural_network_classifier_and_regressor.ipynb

* fix lint, mypy

* Update 02_neural_network_classifier_and_regressor.ipynb

* added test_vqr.py

* updated readme

Co-authored-by: Stefan Woerner <WOR@zurich.ibm.com>
Co-authored-by: Anton Dekusar <adekusar@ie.ibm.com>
Co-authored-by: Manoel Marques <Manoel.Marques@ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants