Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion dpsynth/discrete_mechanisms/independent.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,13 @@ def run_mechanism(

potentials = initial_potentials
if potentials is not None:
potentials = potentials.expand([m.clique for m in measurements])
# `measurements` can contain the same clique more than once (the one-way

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the bug fix, but can you remove this inline comment or reduce it to 1 line?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also add test coverage for this case?

# marginals passed in via `initial_measurements` plus the one-way marginals
# measured in the loop above). `CliqueVector.expand` requires unique cliques
# and otherwise raises "Cliques must be unique.", so de-duplicate while
# preserving order before expanding.
unique_cliques = list(dict.fromkeys(m.clique for m in measurements))
potentials = potentials.expand(unique_cliques)

model = mbi.estimation.mirror_descent(
data.domain,
Expand Down
Loading