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

Update _layering.py #1577

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Update _layering.py #1577

wants to merge 3 commits into from

Conversation

zcoder
Copy link

@zcoder zcoder commented Nov 26, 2023

add: class SignificantFigure(Int):
Rounds data to a specified number of significant figures.

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Motivation and Context / Related issue

Why is this change required?

This change introduces the SignificantFigure layer into the Nevergrad optimization library, addressing a specific need for precise control over the numerical precision of parameters during the optimization process. The current version of Nevergrad does not offer an in-built method to enforce a specific number of significant figures in its parametrization process. This limitation can lead to challenges in scenarios where the precision of parameters, defined by the number of significant digits, is crucial, such as in scientific computations, financial models, or engineering simulations.

What problem does it solve?

The SignificantFigure layer solves the problem of rounding parameter values to a defined number of significant figures. This is particularly useful when working with parameters that can vary over wide ranges, where the precision in terms of decimal places may not be consistent across different magnitudes. The introduction of this layer ensures that the parameters are handled consistently, irrespective of their scale, enhancing the robustness and accuracy of the optimization results.

Furthermore, this change enables Nevergrad users to more closely align the optimization process with domain-specific requirements regarding numerical precision, thereby expanding the library's applicability and utility in various technical and scientific fields.

How Has This Been Tested (if it applies)

tested localy

Checklist

if this functionality is needed in nevergrad, I will complete all the necessary items required for merge (nevergrad/contributing.html)

  • The documentation is up-to-date with the changes I made.
  • I have read the CONTRIBUTING document and completed the CLA (see CLA).
  • All tests passed, and additional code has been covered with new tests.

add: class SignificantFigure(Int):
    Rounds data to a specified number of significant figures.
@facebook-github-bot facebook-github-bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Nov 26, 2023
@teytaud
Copy link
Contributor

teytaud commented Jun 6, 2024

Hello! Can you run black and then everything should be ok ?

fix: black tests error (reformat nevergrad/parametrization/_layering.py)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Do not delete this pull request or issue due to inactivity.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants