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

Add models.encodings.binary_encoder for real-valued data #1551

Merged
merged 17 commits into from
Jan 7, 2025

Conversation

renatomello
Copy link
Contributor

@renatomello renatomello commented Dec 23, 2024

Will generalize to complex-valued data in a separate PR soon.

Checklist:

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

@renatomello renatomello added documentation Improvements or additions to documentation enhancement New feature or request labels Dec 23, 2024
@renatomello renatomello added this to the Qibo 0.2.15 milestone Dec 23, 2024
@renatomello renatomello self-assigned this Dec 23, 2024
@renatomello renatomello marked this pull request as draft December 23, 2024 17:17
@renatomello renatomello marked this pull request as ready for review December 23, 2024 17:34
Copy link

codecov bot commented Dec 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.68%. Comparing base (2e0450b) to head (ffdc2d4).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1551   +/-   ##
=======================================
  Coverage   99.67%   99.68%           
=======================================
  Files          76       76           
  Lines       11234    11271   +37     
=======================================
+ Hits        11198    11235   +37     
  Misses         36       36           
Flag Coverage Δ
unittests 99.68% <100.00%> (+<0.01%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

src/qibo/models/encodings.py Outdated Show resolved Hide resolved
src/qibo/models/encodings.py Outdated Show resolved Hide resolved
src/qibo/models/encodings.py Outdated Show resolved Hide resolved
src/qibo/models/encodings.py Outdated Show resolved Hide resolved
@@ -116,8 +116,69 @@ def phase_encoder(data, rotation: str = "RY", **kwargs):
return circuit


def binary_encoder(data, **kwargs):
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you share the reference/the idea you followed here to implement the binary encoding on this way?
Is that an alternative way to implement the "standard" binary encoding by means of controlled rotations?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure what you mean by "standard", since there are many ways to do binary encoding. This specific one is something that @GoGoKo699 and I have been working on, but it is not published yet. The only difference here is that the amplitudes are parameterized in a specific coordinate system in a $d$-dimensional hypersphere (in this case, called Hopf coordinates).

src/qibo/models/encodings.py Outdated Show resolved Hide resolved
Copy link
Contributor

@BrunoLiegiBastonLiegi BrunoLiegiBastonLiegi left a comment

Choose a reason for hiding this comment

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

Thanks, just remove the two commented lines pointed out by @MatteoRobbiati and this can be merged by my side.

@renatomello renatomello added this pull request to the merge queue Jan 7, 2025
Merged via the queue into master with commit c17a2db Jan 7, 2025
25 checks passed
@renatomello renatomello deleted the binary_encoder branch January 7, 2025 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants