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

Create Pybind wrappers for the Quantiles class

未关闭
#485 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
45/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
cpp, python
领域
api

调研方向

Start with cc/algorithms/quantiles.h to compare the C++ Builder and public methods, then inspect pydp/src/bindings/PyDP/algorithms/qunatile_tree.cpp for PyDP binding conventions. Add pydp/src/bindings/PyDP/algorithms/quantiles.cpp for the double instantiation, status handling, and mechanism enum. Done means the listed methods are exposed and Build failures raise Python exceptions.

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

描述

Type: New Feature :heavy_plus_sign:

Create Pybind wrappers for the Quantiles class

Create Pybind11 wrappers for the differential_privacy::Quantiles. This will expose the functionality to the PyDP library.

Background:

The C++ Differential Privacy library includes a Quantiles class for calculating differentially private quantiles ( source). The PyDP library, which provides Python wrappers for the C++ library, already has bindings for the QuantileTree class ( Python differential pr...). To provide a more complete and user-friendly API, we should also create wrappers for the higher-level Quantiles class.

Implementation Details:

The new wrappers should be created in a new file, pydp/src/bindings/PyDP/algorithms/quantiles.cpp. The Python API should follow the existing conventions in PyDP and mirror the C++ API of the Quantiles class as closely as possible.

The Quantiles class is templated on arithmetic types (int, double, etc.). The Pybind wrappers should be instantiated for common numerical only for double.

Classes and Methods to Wrap:

  1. Quantiles.__init__: which calls Quantiles<double>::Builder. It should have all parameters as in Builder.

  2. Quantiles

The following public methods of the Quantiles class should be wrapped:

AddEntry(const T&)
Serialize() const
Merge(const Summary&)
GetQuantiles() const
Result()

Considerations:

  1. The Build() method returns an absl::StatusOr. The wrappers should handle the status and raise an exception on failure.

  2. The SetLaplaceMechanism method takes a std::unique_ptr. For Python binding let's use enum - Laplace, Gaussian.

主要语言
Python
星标
550
派生
142
PR 合并指标
30 天内没有已合并 PR

环境准备

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

从这里开始

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

OpenMined/PyDP 的其他 Issue

查看 OpenMined/PyDP 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

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