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

[Feature] Generalize parameter constraints over certain range #230

Open
jpmoutinho opened this issue Nov 29, 2023 · 2 comments
Open

[Feature] Generalize parameter constraints over certain range #230

jpmoutinho opened this issue Nov 29, 2023 · 2 comments
Assignees
Labels
feature New feature or request refactoring Refactoring of legacy code to_check To check in the development of the new expression system.

Comments

@jpmoutinho
Copy link
Collaborator

jpmoutinho commented Nov 29, 2023

When running parameterized digital-analog programs parameters often have to be optimized while bounded over a specific range. For example, currently in the AddressingPattern class this is done by re-defining the parameters with a multiplication with a Heaviside function such that values outside the allowed range are counted as zero. To note that for optimization purposes, a smooth approximation of the Heaviside needs to be used for gradient calculation, as currently done in the addressing pattern.

This can potentially be generalized, either as a general function or directly inside the Qadence VariationalParameter to be used in other modules.

Potentially related: can parameters like angles be defined mod 2 pi?

@jpmoutinho jpmoutinho added feature New feature or request refactoring Refactoring of legacy code labels Nov 29, 2023
@jpmoutinho jpmoutinho self-assigned this Nov 29, 2023
@jpmoutinho
Copy link
Collaborator Author

This is potentially needed to deal with the domain of certain functions in #267

E.g., the trainable frequencies for a chebyshev feature map should respect the domain of acos being (-1, 1). Since there is already a target_range parameter that re-scales the data to that range, it would be enough that the trainable frequencies stay inside the (0, 1) range.

A few potentially relevant links from the web:

https://discuss.pytorch.org/t/set-constraints-on-parameters-or-layers/23620/3
https://discuss.pytorch.org/t/restrict-range-of-variable-during-gradient-descent/1933

@jpmoutinho jpmoutinho added the to_check To check in the development of the new expression system. label May 14, 2024
@mlahariya
Copy link
Collaborator

Might be useful but low priority. Check its usefulness for Qadence 2.
@mlahariya, check its usefulness and if needs to be implemented.

@mlahariya mlahariya assigned mlahariya and unassigned jpmoutinho Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request refactoring Refactoring of legacy code to_check To check in the development of the new expression system.
Projects
None yet
Development

No branches or pull requests

2 participants