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

[Draft] Expansion of Observable_config #664

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

minutogiovanni
Copy link
Collaborator

No description provided.

@smitchaudhary
Copy link
Collaborator

Please rebase the branch on main. A previous PR of mine modified the test_qnn file.

@smitchaudhary smitchaudhary changed the title Expansion of Observable_config [Draft] Expansion of Observable_config Feb 6, 2025
Copy link

codecov bot commented Feb 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.78%. Comparing base (e0b275d) to head (6573c51).
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #664      +/-   ##
==========================================
- Coverage   85.79%   85.78%   -0.02%     
==========================================
  Files         197      197              
  Lines       16971    16984      +13     
  Branches     1452     1453       +1     
==========================================
+ Hits        14561    14570       +9     
- Misses       1994     1998       +4     
  Partials      416      416              

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

docs/tutorials/qml/config_qnn.md Outdated Show resolved Hide resolved
docs/tutorials/qml/config_qnn.md Show resolved Hide resolved
qadence/constructors/hamiltonians.py Outdated Show resolved Hide resolved
qadence/constructors/hamiltonians.py Outdated Show resolved Hide resolved
qadence/ml_tools/constructors.py Show resolved Hide resolved
@smitchaudhary
Copy link
Collaborator

Thanks.

Not very comprehensive, but some of the things here are being discussed in the PR here where the configs were introduced. Might give some insight into why certain things were done. (Having said that, feel free to just ask instead of going on a wild chase).

@smitchaudhary smitchaudhary linked an issue Feb 10, 2025 that may be closed by this pull request
Comment on lines 341 to 363
def ising_hamiltonian_config(
x_scale: TParameter = 1.0,
x_shift: TParameter = 0.0,
x_transformation_type: ObservableTransform = ObservableTransform.NONE, # type: ignore[assignment]
zz_scale: TParameter = 1.0,
zz_shift: TParameter = 0.0,
zz_transformation_type: ObservableTransform = ObservableTransform.NONE, # type: ignore[assignment]
trainable_transform: bool | None = None,
) -> List[ObservableConfig]:
zz_ham = zz_hamiltonian_config(
scale=zz_scale,
shift=zz_shift,
transformation_type=zz_transformation_type,
trainable_transform=trainable_transform,
)
x_ham = ObservableConfig(
detuning=X,
scale=x_scale,
shift=x_shift,
transformation_type=x_transformation_type,
trainable_transform=trainable_transform,
)
return [zz_ham, x_ham]
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this can be changed to return a single config that when the user passes to QNN.from_configs gives you the Ising Hamiltonian as the observable instead of giving us a list of 2 ObservableConfigs, which would result in the QNN giving 2 outputs, one for the ZZ as observable, and the other as X as observable. See ising_hamiltonian.

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.

Expanding ObservableConfig to Multi-Qubit Interactions
2 participants