Refactor discrete mechanisms from inheritance to composition, simplifying Independent, Direct, and SWIFT configurations. - #135
Open
copybara-service[bot] wants to merge 1 commit into
Open
Conversation
copybara-service
Bot
force-pushed
the
cl/964696330
branch
from
August 14, 2026 15:24
d378345 to
3444693
Compare
copybara-service
Bot
force-pushed
the
cl/964696330
branch
16 times, most recently
from
August 14, 2026 21:55
a165596 to
2714605
Compare
copybara-service
Bot
force-pushed
the
cl/964696330
branch
7 times, most recently
from
August 15, 2026 00:17
f7b80e0 to
0d7c747
Compare
…e, making it much easier to understand and reason about the code, while retaining the main code sharing benefits of the previous approach. Previously, DiscreteMechanism was a parent class that handled one-way marginal measurement + domain compression, then delegated to subclass for the rest of the mechanism. Now DiscreteMechanism is a standalone class defining a one_way_budget_fraction, a domain_compression flag and a base_mechanism. It measures one way marginals then calls the base mechanism. This means that the base mechanism implementations are usually completely self-contained in their corresponding file, and the (dp_event, __call__) can be verified to match on a file-by-file basis. DiscreteMechanism handles the composed event via dp_accounting.ComposedEvent and can similarly be easily verified to be correct locally to that file (assuming the base_mechanism.dp_event is correct). Now, DiscreteConfig / DiscreteMechanism sits side-by-side to TabularConfig / TabularMechanism, and should be preferred when users have pre-discretized data (e.g., mbi.Dataset) instead of a regular tabular dataset with various column types. PiperOrigin-RevId: 964696330
copybara-service
Bot
force-pushed
the
cl/964696330
branch
from
August 15, 2026 00:19
0d7c747 to
9db1dd3
Compare
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.
Refactor discrete mechanisms from inheritance to composition, simplifying Independent, Direct, and SWIFT configurations.