-
Notifications
You must be signed in to change notification settings - Fork 17
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 loss functions for phase retrieval #236
Conversation
Codecov Report
@@ Coverage Diff @@
## main #236 +/- ##
==========================================
+ Coverage 92.52% 92.62% +0.09%
==========================================
Files 49 49
Lines 3452 3512 +60
==========================================
+ Hits 3194 3253 +59
- Misses 258 259 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
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.
On names the length of names: I lean toward working to make them fewer words rather than abbreviating more of the words. Specific ideas:
First, strip out Loss
from all of them. This is consistent with how we do operators (e.g., we use CircularConvolve
not CircularConvolveLinOp
) and no less readable, especially if use qualified: Loss.WeightedSquaredL2Abs
.
Second, don't try to mention every aspect of the loss. SquaredL2Loss
-> Loss.L2
. The first line of the docstring will clear up any confusion. WeightedSquaredL2Loss
-> Loss.L2
, if the user passes weights, they get weights, document this fact.
For the optics loss, maybe it has a name in the optics community. By analogy, Loss.Poisson
rather than WeightedLogPlusLogLoss
.
W: Weighting diagonal operator. Must be non-negative. | ||
If ``None``, defaults to :class:`.Identity`. | ||
""" | ||
y = ensure_on_device(y) |
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.
I believe ensure_on_device
is deprecated. Agreed?
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.
Really? It was in all the existing loss functions before the additional ones were added.
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.
That is a good idea. Name collision with some of the functionals (specifically the norms) is not ideal, but is worth putting up with, I think.
You're suggesting renaming
That would be reasonable, but unfortunately I'm not aware of any compact names for them, and I suspect they don't exist. |
Yes, as an example to make the broader point that some of the extra words may be a result of having extra classes. There may be reasons why that specific change cannot/should not be made. |
I think that's reasonable: the way we handle L2 vs WeightedL2 at the moment seems a bit contrived, and could easily be replaced with one class with optional weights. I'm going to back off from supporting the removal of the "Loss" part of the name, though, since it's consistent with usage in |
Hm, how does |
The problem is that there are many functionals that aren't norms, including
There are many more functionals than the norms, so I don't think it's feasible to remove |
See most recent commit. I think the removal of "Weighted" brings the names within acceptable lengths, and removes the need for further agonizing about this. |
Add loss functions for phase retrieval.
The names of the new loss functions are rather cumbersome:
WeightedSquaredL2AbsLoss
andWeightedSquaredL2AbsSquaredLoss
. Any suggestions for shorter alternatives? Perhaps something likeWeightSqrL2AbsLoss
andWeightSqrL2AbsSqrLoss
(which would also imply changingSquaredL2Loss
toSqrL2Loss
andWeightedSquaredL2Loss
toWeightSqrL2Loss
)?