Add domain compression API to discrete mechanisms#56
Open
copybara-service[bot] wants to merge 1 commit into
Open
Add domain compression API to discrete mechanisms#56copybara-service[bot] wants to merge 1 commit into
copybara-service[bot] wants to merge 1 commit into
Conversation
2085afa to
a4c6118
Compare
Introduce pure-function compression API in `common.py` for all discrete mechanisms. Each mechanism can now optionally compress rare categorical values (count < 3*sigma) into an "Other" bin — a privacy-free post-processing step that shrinks the domain for faster PGM estimation. New public functions: - `compress_measurements(one_way_measurements, columns)`: returns `(rare_value_masks, compressed_measurements)`. - `compress_dataset(data, rare_value_masks)`: compresses an mbi.Dataset via `vtx.merge_rare_values`. - `decompress_dataset(data, original_domain, rare_value_masks, rng)`: restores merged rare values via `vtx.unmerge_rare_values`. `DiscreteMechanismResult` exposes `rare_value_masks` and `original_domain` so callers can decompress explicitly. PiperOrigin-RevId: 937313573
a4c6118 to
0329f45
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.
Add domain compression API to discrete mechanisms
Introduce pure-function compression API in
common.pyfor all discretemechanisms. Each mechanism can now optionally compress rare categorical
values (count < 3*sigma) into an "Other" bin — a privacy-free
post-processing step that shrinks the domain for faster PGM estimation.
New public functions:
compress_measurements(one_way_measurements, columns): returns(rare_value_masks, compressed_measurements).compress_dataset(data, rare_value_masks): compresses an mbi.Datasetvia
vtx.merge_rare_values.decompress_dataset(data, original_domain, rare_value_masks, rng):restores merged rare values via
vtx.unmerge_rare_values.DiscreteMechanismResultexposesrare_value_masksandoriginal_domainso callers can decompress explicitly.