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

Classify qubit states #261

Merged
merged 118 commits into from
Mar 31, 2023
Merged

Classify qubit states #261

merged 118 commits into from
Mar 31, 2023

Conversation

Edoardo-Pedicillo
Copy link
Contributor

@Edoardo-Pedicillo Edoardo-Pedicillo commented Mar 1, 2023

This PR introduces the folder qibocal/extras, where there are the classifiers benchmarks.
Checklist:

  • Reviewers confirm new code works as expected.
  • Tests are passing.
  • Coverage does not decrease.
  • Documentation is updated.

@Edoardo-Pedicillo Edoardo-Pedicillo marked this pull request as draft March 1, 2023 13:45
@codecov
Copy link

codecov bot commented Mar 1, 2023

Codecov Report

Merging #261 (69f2f68) into main (4cfb560) will increase coverage by 2.72%.
The diff coverage is 51.65%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #261      +/-   ##
==========================================
+ Coverage   35.11%   37.84%   +2.72%     
==========================================
  Files          30       42      +12     
  Lines        2355     2801     +446     
==========================================
+ Hits          827     1060     +233     
- Misses       1528     1741     +213     
Flag Coverage Δ
unittests 37.84% <51.65%> (+2.72%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/qibocal/fitting/classifier/ada_boost.py 0.00% <0.00%> (ø)
src/qibocal/fitting/classifier/gaussian_process.py 0.00% <0.00%> (ø)
src/qibocal/fitting/classifier/naive_bayes.py 0.00% <0.00%> (ø)
src/qibocal/fitting/classifier/nn.py 0.00% <0.00%> (ø)
src/qibocal/fitting/classifier/qubit_fit.py 0.00% <0.00%> (ø)
src/qibocal/fitting/classifier/random_forest.py 0.00% <0.00%> (ø)
src/qibocal/fitting/classifier/rbf_svm.py 0.00% <0.00%> (ø)
src/qibocal/fitting/methods.py 71.92% <20.00%> (+0.50%) ⬆️
src/qibocal/fitting/classifier/run.py 81.61% <81.61%> (ø)
src/qibocal/fitting/classifier/utils.py 83.33% <83.33%> (ø)
... and 3 more

src/qibocal/fitting/classifier/qubit_fit.py Outdated Show resolved Hide resolved
src/qibocal/fitting/classifier/qubit_fit.py Outdated Show resolved Hide resolved
src/qibocal/fitting/classifier/qubit_fit.py Outdated Show resolved Hide resolved
src/qibocal/fitting/classifier/run.py Outdated Show resolved Hide resolved
src/qibocal/fitting/classifier/run.py Outdated Show resolved Hide resolved
@alecandido
Copy link
Member

@Edoardo-Pedicillo @scarrazza from what I understood "Ramiro"'s method is a linear SVM, simply manually fitted.

Is there any value in using that, instead of an actual SVM? (or just the Naive Bayes, that is orders of magnitude faster)

Of course, the current implementation is definitely useful for benchmarking, and to prove the effectiveness and performances of the other methods.

pyproject.toml Outdated
networkx = "^3.0"
pydantic = "^1.10.5"
pydot = { version = "^1.4.2", optional = true }
tensorflow-io-gcs-filesystem = "0.31"
Copy link
Member

Choose a reason for hiding this comment

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

Why do you need extra IO support?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because the workflow has failed, I think that the problem with tensorflow-io-gcs-filesystem is that there was a new release on Mar 29,2023 that has not the Windows wheels. Maybe I should put tensorflow-io-gcs-filesystem = "^0.31".

Copy link
Member

@alecandido alecandido Mar 30, 2023

Choose a reason for hiding this comment

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

No, the problem is in a dependency of a dependency, do not add it to your own to make it passing on Windows.

We can think about more refined solutions, in particular dropping who depends on that, or lowering the related version, but if you don't use it directly, don't declare it among your deps :)

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, I know, obviously tensorflow has this dependecy, I checked but downgrading it doesn't solve the problem. I can try with the other dependencies, but this could be a lot time-consuming. Do you have some hints to solve it as soon as possible?

Copy link
Member

Choose a reason for hiding this comment

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

It is definitely a non-trivial problem. Proper solutions are:

I'm trying to consider if there are other possible workarounds, in order to avoid a direct dependency on tensorflow-io-gcs-filesystem, that we don't use.

src/qibocal/fitting/classifier/nn.py Outdated Show resolved Hide resolved
src/qibocal/fitting/classifier/qubit_fit.py Outdated Show resolved Hide resolved
@alecandido alecandido mentioned this pull request Mar 30, 2023
4 tasks
Copy link
Member

@alecandido alecandido left a comment

Choose a reason for hiding this comment

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

Last few comments, but there is nothing blocking :)

After these we can merge (if needed, even before).

src/qibocal/fitting/classifier/qubit_fit.py Outdated Show resolved Hide resolved
src/qibocal/fitting/classifier/qubit_fit.py Outdated Show resolved Hide resolved
src/qibocal/fitting/classifier/qubit_fit.py Outdated Show resolved Hide resolved
src/qibocal/fitting/classifier/plots.py Show resolved Hide resolved
Copy link
Member

@alecandido alecandido left a comment

Choose a reason for hiding this comment

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

Let's try this way: we won't have tf on Windows, but we're mostly not even using it.

pyproject.toml Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
tests/test_classifier.py Show resolved Hide resolved
@Edoardo-Pedicillo
Copy link
Contributor Author

@scarrazza this PR is ready to be merged.

@scarrazza
Copy link
Member

Very good, thanks.

@scarrazza scarrazza merged commit 6a0e17d into main Mar 31, 2023
@scarrazza scarrazza deleted the classify-qubit-states branch March 31, 2023 11:51
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.

None yet

3 participants