qiboteam / qibo

A framework for quantum computing
https://qibo.science
Apache License 2.0
289 stars 60 forks source link

Circuit examples for release #99

Closed scarrazza closed 4 years ago

scarrazza commented 4 years ago

Another suggestion from @joseignaciolatorre , here some circuits that we should ship with QIBO for the release:

DiegoGM91 commented 4 years ago

I have coded a quantum classifier using QIBO. I can provide the code if you want to

AdrianPerezSalinas commented 4 years ago

I propose to create a new folder (possibly a new branch) where we can code everything and merge it when everything is ready. Everyone should update only his/her part. What do you think about that?

scarrazza commented 4 years ago

Yes, let me summarize the procedure:

  1. clone the latest master
  2. create your custom branch with git checkout -b mybranch (where you replace a mybranch with a different name)
  3. create a top level folder called examples
  4. place your script there
  5. when you are ready create a pull request (via github or after pushing) for review
stavros11 commented 4 years ago

If anyone has never used git before and is confused with this procedure let me know and I might be able to help. I am not a git expert but can demonstrate the couple of commands required for this.

AdrianPerezSalinas commented 4 years ago

Hi, I have already finished the core of my pieces of examples. Could someone please take a look at it and tell me if there is something to adapt with regard to how to present the codes? Thanks!

My branch is examples_adrian

scarrazza commented 4 years ago

@AdrianPerezSalinas please open a pull request with your branch pointing to master, with https://github.com/Quantum-TII/qibo/compare.

scarrazza commented 4 years ago

@DiegoGM91 from the list above I see that there is a text/image classifier example missing, are you working on it?

DiegoGM91 commented 4 years ago

Hi @scarrazza. Yes, it is already coded and working. The problem is that the accuracy that I get for the classification task with the iris toy data set is not very high. So I would say those results are not good enough to be publicly shown. I've used the same code to correctly classify texts belonging to two separate classes, but I believe the texts come from a data set that is confidential. And so these results would no be reproducible by a qibo user looking at the example.

Thus, I want to try with a different data set. Hopefully, the quantum circuit will deliver good results this time. If that's the case, I'll make the pull request.

joseignaciolatorre commented 4 years ago

Diego,

remember you have to rescale the data, as a preprocessing. Words frequencies are naturally bounded to 0. The iris toy data set may be different. If you do not do that, you are forcing the circuit to learn the details on a compressed and small piece of the Hilbert space.

On Thu, Jul 9, 2020 at 1:27 PM Diego García-Martín notifications@github.com wrote:

Hi @scarrazza https://github.com/scarrazza. Yes, it is already coded and working. The problem is that the accuracy that I get for the classification task with the iris toy data set is not very high. So I would say those results are not good enough to be publicly shown. I've used the same code to correctly classify texts belonging to two separate classes, but I believe the texts come from a data set that is confidential. And so these results would no be reproducible by a qibo user looking at the example.

Thus, I want to try with a different data set. Hopefully, the quantum circuit will deliver good results this time. If that's the case, I'll make the pull request.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Quantum-TII/qibo/issues/99#issuecomment-656072376, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIRGEIGL66KMAOHGRUFCT73R2WSTDANCNFSM4NN4ZGDA .

DiegoGM91 commented 4 years ago

Hi,

This makes a lot of sense. I have re-scaled the data, which resulted in slightly better results. However, I think an additional problem was that the circuit was not deep enough. I'm trying with way deeper circuits (no less than 10 layers), and now I'm getting a more decent classification accuracy (around 83%).

I will therefore prepare a readme.md file and make the pull request if you think this is acceptable (I think it is).

However, maybe it makes more sense to choose an easier classification example (like dots inside and outside a circle), because for the iris data set the minimization takes now several hours, which might not be what we are looking for in these circuit examples. So I don't know, what do you think?

scarrazza commented 4 years ago

@DiegoGM91, the irisi is a good example because it is standard, but in principle you can create a single example which takes as input an argument which selects the dataset. I would suggest to create a PR with the training template and then plug both datasets as command line options.

scarrazza commented 4 years ago

@DiegoGM91 are you planning to open a PR with the classification example?