SKLearn Pipeline calculate sensitivity of categorical features for Local DP
@grilhami 已经在做这个了。
开始于 2021年11月30日。
评估
这个 Issue 还没有评估数据。
描述
Feature Description
The current SKLearn Pipeline noise mechanism "operator" for Local DPassumes that the dataset given contains only all numerical features. This means that noise is calculated on top of the sensitivity calculation on numerical features.
However, most often, datasets also contain categorical features, which requires a different method to calculate the sensitivity. The "operator" should also support categorical features.
This applies to all the noise mechanisms: LaplaceMechanism, GaussianMechanism, and GeometricMechanism.
Note: as far as this issue was created, only LaplaceMechanism has been implemented, so it's a good starting point to start with LaplaceMechanism. Once GeometricMechanism and GaussianMechanism have been implemented, the specifications for categorical feature support are the same.
Additional Context
Preferably, the support for the categorial features would be in the form of parameters for the "operator" class.
For example, in the case of LaplaceMechanism, it would look something like this:
# Set a privacy budget accountant
accountant = BudgetAccountant(10000)
# Set sensitivity function for numerical data
sensitivity = lambda x: (max(x) - min(x))/ (len(x) + 1)
# Set sensitivity function for categorical data
sensitivity_cat = lambda x: ...
# Indecies of the categorical features in the dataset
cat_features = [0, 1, ...]
# Set laplace mechanism with epsilon, sensitivity, and accountant
laplace = LaplaceMechanism(
epsilon=0.1,
sensitivity=sensitivity,
accountant=accountant,
sensitivity_cat=sensitivity_cat,
cat_features=cat_features
)
# Initialize scaler and naive bayes extimator
scaler = StandardScaler()
nb = GaussianNB()
# Create the pipeline
pipe = Pipeline([('scaler', scaler), ('laplace', laplace), ('nb', nb)])
For more examples, please have look at the notebook example of Laplace Mechanism's implementation.
As starting guidance, please refer to the source code for LaplaceMechanism in here.
- 主要语言
- Python
- 星标
- 550
- 派生
- 142
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
OpenMined/PyDP 的其他 Issue
-
Type: New Feature :heavy_plus_sign:
难度 4/5 3-5 天 新手友好度 45/100
-
Type: Question :grey_question:
难度 3/5 1-2 天 新手友好度 25/100
-
Type: Question :grey_question:
难度 4/5 3-5 天 新手友好度 32/100
-
Type: Improvement :chart_with_upwards_trend:
难度 3/5 1-2 天 新手友好度 35/100
-
Type: New Feature :heavy_plus_sign:
难度 3/5 1-2 天 新手友好度 38/100
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
-
bug
难度 1/5 1 小时以内 新手友好度 88/100
qgis/QGIS-Plugins-Website#459 ·
-
bug severity:medium
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 2 天内回复
-
bot-found bug priority: P3
难度 2/5 1-3 小时 新手友好度 84/100
madenvel/KalinkaPlayer#179 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
ls1intum/edutelligence#1098 ·
维护者通常 1 天内回复