Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

`IndependentConfig` synthesis raises "Cliques must be unique."

未关闭 适合新手
#2 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

  • #4 来自 @gghatano —— 已关闭,未合并

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
82/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
冷清
技术栈
pandas, python

调研方向

从 dpsynth/discrete_mechanisms/independent.py 第 73 行开始,使用 IndependentConfig 运行提供的 pandas 复现代码。确认 INDEPENDENT 路径不再引发 duplicate-clique ValueError,同时 MST 和 AIM 仍能正常工作,并且估计输入保持不变。

由索引模型根据 Issue 内容生成。

描述

Summary

Calling dpsynth.generate(...) with discrete_config=IndependentConfig() fails
with a ValueError from mbi.CliqueVector.expand. MST and AIM work on the same
input; only INDEPENDENT is affected.

Environment

  • Linux, Python 3.12, current mbi (git+https://github.com/ryan112358/mbi.git)

Reproduction

import pandas as pd
import dpsynth
from dpsynth import domain, discrete_mechanisms as dm

df = pd.DataFrame({
    "a": ["x", "y", "x", "y"] * 50,
    "b": [0, 1, 1, 0] * 50,
})
domains = {
    "a": domain.CategoricalAttribute(possible_values=["x", "y"]),
    "b": domain.CategoricalAttribute(possible_values=[0, 1]),
}
dpsynth.generate(df, domains, epsilon=1.0, delta=1e-5,
                 discrete_config=dm.IndependentConfig())
ValueError: Cliques must be unique.
  File ".../dpsynth/discrete_mechanisms/independent.py", line 73, in run_mechanism
    potentials = potentials.expand([m.clique for m in measurements])
  File ".../mbi/clique_vector.py", line 55, in __attrs_post_init__
    raise ValueError("Cliques must be unique.")

Cause

In independent.run_mechanism, measurements starts from
initial_measurements — the one-way marginals that
data_generation_v2.generate always passes in — and then the loop appends a
freshly measured one-way marginal for every attribute. So measurements
contains each one-way clique twice.

When initial_potentials is not None (e.g. the empty CliqueVector returned by
constraints.get_initial_parameters even when there are no cross-attribute
constraints), line 73 calls
potentials.expand([m.clique for m in measurements]) with that duplicated
clique list. Current mbi requires unique cliques in expand, so it raises.

Suggested fix

De-duplicate the clique list (order-preserving) before calling expand. The
measurements passed to mirror_descent are left unchanged, so estimation and
privacy accounting are unaffected. PR attached.

主要语言
Python
星标
32
派生
13
平均合并
1 天 19 小时
30 天内合并 PR
20

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

google/dpsynth 的其他 Issue

查看 google/dpsynth 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。