Skip to content

Refactor discrete mechanisms from inheritance to composition, simplifying Independent, Direct, and SWIFT configurations. - #135

Open
copybara-service[bot] wants to merge 1 commit into
mainfrom
cl/964696330
Open

Refactor discrete mechanisms from inheritance to composition, simplifying Independent, Direct, and SWIFT configurations.#135
copybara-service[bot] wants to merge 1 commit into
mainfrom
cl/964696330

Conversation

@copybara-service

@copybara-service copybara-service Bot commented Aug 14, 2026

Copy link
Copy Markdown

Refactor discrete mechanisms from inheritance to composition, simplifying Independent, Direct, and SWIFT configurations.

@copybara-service copybara-service Bot changed the title Refactor discrete mechanisms from inheritance to composition Refactor discrete mechanisms from inheritance to composition. Aug 14, 2026
@copybara-service
copybara-service Bot force-pushed the cl/964696330 branch 16 times, most recently from a165596 to 2714605 Compare August 14, 2026 21:55
@copybara-service copybara-service Bot changed the title Refactor discrete mechanisms from inheritance to composition. Refactor discrete mechanisms from inheritance to composition, simplifying Independent, Direct, and SWIFT configurations. Aug 14, 2026
@copybara-service
copybara-service Bot force-pushed the cl/964696330 branch 7 times, most recently from f7b80e0 to 0d7c747 Compare August 15, 2026 00:17
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants