-
Notifications
You must be signed in to change notification settings - Fork 186
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 interp_scale to parameter scaling #4218
base: main
Are you sure you want to change the base?
Conversation
2f7d4eb
to
cf9e393
Compare
Thanks @QRemy! Should deprecate the "old scaling" methods? @registerrier |
For now they are still applied after the scaling from the .interp argument, not sure if it makes sense. I would prefer to keep them even if they are not applied in a row but alternatively, so we can still try to reproduce previous results. |
@QRemy I think we never really discussed this PR in our dev call, would you mind setting it on the agenda for this Friday? https://github.com/gammapy/gammapy-meetings/tree/master/dev-meetings/2023/2023-01-27 Thanks! |
cf9e393
to
037fc9e
Compare
For backward compatibility I added a |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4218 +/- ##
===========================================
+ Coverage 75.71% 94.82% +19.10%
===========================================
Files 228 215 -13
Lines 33778 30361 -3417
===========================================
+ Hits 25576 28790 +3214
+ Misses 8202 1571 -6631 ☔ View full report in Codecov by Sentry. |
3bc58ef
to
34ed762
Compare
Two things:
|
@QRemy what is the status of this work? |
Signed-off-by: Quentin Remy <quentin.remy@mpi-hd.mpg.de>
Signed-off-by: Quentin Remy <quentin.remy@mpi-hd.mpg.de>
Signed-off-by: Quentin Remy <quentin.remy@mpi-hd.mpg.de>
Signed-off-by: Quentin Remy <quentin.remy@mpi-hd.mpg.de>
34ed762
to
b9b8b27
Compare
Signed-off-by: Quentin Remy <quentin.remy@mpi-hd.mpg.de>
@QRemy, what is the status here? |
The error propagation for the transform is still missing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot @QRemy. It seems more coherent now. I have just put some suggestions on the docstrings
@@ -97,6 +97,8 @@ class Parameter: | |||
Whether the parameter represents the flux norm of the model. | |||
prior : `~gammapy.modeling.models.Prior` | |||
Prior set on the parameter. | |||
scale_interp : {"lin", "sqrt", "log"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you profit of this PR to add in the docstring all the default values? Thanks
self.factor, self.scale = 1, self.value | ||
self._scale = value | ||
|
||
def transform(self, value, update_scale=False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does exactly this function? Do not forget the default value of the argument
self.update_scale(factor) | ||
return factor / self.scale | ||
|
||
def inverse_transform(self, factor): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does exactly this function? A docstring might be great
@@ -824,12 +859,16 @@ def __init__( | |||
min=np.nan, | |||
max=np.nan, | |||
error=0, | |||
scale_method="scale10", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AS this class is exposed, it might be great to add a docstring describing it with its parameters (and default values)
Co-authored-by: Bruno Khélifi <khelifi@in2p3.fr>
I will try a solution based on |
Use the interpolation scale given by Parameter.interp in the transform from the parameter value to the factor seen by the optimizer, as proposed in #4027.
Not sure how to combine this with the scale method, for now I apply interp_scale first and then the scale method.