A non-numeric cell in a numeric column raises a data-dependent exception

Đang mở
#288 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

@hanzalaareeb đang làm issue này rồi.

Từ ngày 2/11/2026.

  • #294 của @hanzalaareeb — đang mở

Đánh giá

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

Hướng nghiên cứu

Start with the unguarded float conversions in dpsynth/local_mode/initialization.py and dpsynth/local_mode/vectorized_transformations.py, then trace how numeric cell values are standardized before histogram aggregation. Reproduce the failure with the provided ? value in the numeric column and check related tests. Done means malformed numeric values are handled consistently with the documented per-row standardization, without a data-dependent exception.

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

Mô tả

The accounting philosopy doc states that "During execution, individual cell values (None, NaN, ±∞, out-of-range numbers, or unknown categories) are standardized deterministically per row before any histogram aggregation occurs (by clamping to declared bounds or routing to a dedicated out-of-domain bin), ensuring that malformed records do not raise data-dependent exceptions that break DP.)".

This doesn't appear to be fully the case: a non-numeric value in a numeric column fails because of unguarded casts to floats here and here. Repro:

import io, math
import numpy as np
import pandas as pd
import dpsynth

D = pd.read_csv(io.StringIO("x\n3\n18\n25\n41\n60\n77\n"))
D2 = pd.read_csv(io.StringIO("x\n3\n18\n25\n41\n60\n77\n?\n"))
N, EPS, DELTA = 20, 1.0, 1e-5
schema = dpsynth.Schema({"x": dpsynth.NumericalAttribute(min_value=0, max_value=100)})
mech = dpsynth.calibrate(dpsynth.TabularConfig(discrete_mechanism=dpsynth.discrete_mechanisms.IndependentConfig(pgm_iters=5)),
                         schema, epsilon=EPS, delta=DELTA)

rng = np.random.default_rng(0)
hits = {}
for name, data in (("D", D), ("D'", D2)):
  hits[name] = 0
  for _ in range(N):
    try:
      mech(rng, data)
    except Exception as e:
      hits[name] += 1

p, p2 = hits["D"] / N, hits["D'"] / N
print(f"P_D[E] = {p:.3f}, P_D'[E] = {p2:.3f}; ({EPS}, {DELTA})-DP allows P_D'[E] <= e^eps * P_D[E] + delta = "
      f"{math.exp(EPS) * p + DELTA:.3f}")

prints:

P_D[E] = 0.000, P_D'[E] = 1.000; (1.0, 1e-05)-DP allows P_D'[E] <= e^eps * P_D[E] + delta = 0.000
Ngôn ngữ chính
Python
Star
32
Fork
13
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

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.