Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở Phù hợp với người mới
#2 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

Chưa có ai nhận issue này.

  • #4 của @gghatano — đã đóng, không merge

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
82/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
pandas, python
Lĩnh vực
data-engineering

Hướng nghiên cứu

Bắt đầu tại dpsynth/discrete_mechanisms/independent.py ở dòng 73 và chạy bản tái hiện pandas được cung cấp với IndependentConfig. Xác minh rằng đường dẫn INDEPENDENT không còn phát sinh duplicate-clique ValueError, trong khi MST và AIM vẫn hoạt động và các đầu vào ước lượng không thay đổi.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Python
Star
32
Fork
13
Merge trung bình
3 ngày 15 giờ
Pull request đã merge (30 ngày)
31

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của google/dpsynth

Tất cả issue của google/dpsynth

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.