fix: l2 loss stddev scaling#101
Merged
ryan112358 merged 3 commits intoryan112358:masterfrom Mar 6, 2026
Merged
Conversation
Contributor
Author
|
By the way, have you considered storing whether noise has been added with laplace or gaussian in LinearMeasurement and automatically choosing l1 or l2 optimization if not explicitly set by the user? |
ryan112358
requested changes
Mar 5, 2026
Owner
ryan112358
left a comment
There was a problem hiding this comment.
Good catch, this is a regression introduced during refactoring. It appears a previous version of the library handled this correctly. Left one comment then we can merge.
Regarding L1 vs. L2 minimization: I recommend using L2 minimization even when adding Laplace noise, since it appears to generalize better. I never figured out why though! See Section D.1 in https://arxiv.org/pdf/1901.09136.
ryan112358
approved these changes
Mar 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We know that$y \mid x \sim \mathcal{N}(x,\ \sigma^2 I)$ . So
therefore (ignoring the constant term)
It's currently$1/\sigma$ , not $1/\sigma^2$ , meaning high-variance estimates are given too much importance.
Let me know if I've misunderstood your API!
EDIT: The code is consistent with the distribution estimation problem as written in the AIM paper section 2.3, which weights squared errors by$1/\sigma$ (and $\sigma$ is stddev). But under the paper's stated noise model the MLE for gaussian noise should weight squared errors by $1/\sigma^2$ (ignoring the half). With this change you then get equivalence to inverse variance weighting (known to be MLE for gaussian).
In AIM, this means later rounds won't improve utility as much as they should if they overlap with a query in an earlier round, which repeatedly triggers the "not significant" criterion and pushes the budget up until early exhaustion. Effect might also be negligible though, haven't tested.