SKLearn Pipeline calculate sensitivity of categorical features for Local DP
@grilhami ci sta già lavorando.
Dal 30/11/2021.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
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.
- Lingua principale
- Python
- Stelle
- 550
- Fork
- 142
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di OpenMined/PyDP
-
Type: New Feature :heavy_plus_sign:
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
-
Type: Question :grey_question:
Difficoltà 3/5 1-2 giorni Idoneità per principianti 25/100
-
Type: Question :grey_question:
Difficoltà 4/5 3-5 giorni Idoneità per principianti 32/100
-
Type: Improvement :chart_with_upwards_trend:
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
-
Type: New Feature :heavy_plus_sign:
Difficoltà 3/5 1-2 giorni Idoneità per principianti 38/100
Tutte le issue di OpenMined/PyDP
Issue simili
-
Claiming namespace `apoint`Apertanamespace operations
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
EclipseFdn/open-vsx.org#13573 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
collective/icalendar#1854 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
rancher/rancher-ai-agent#412 ·
I maintainer di solito rispondono entro 6 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
TUDelftGeodesy/DePSI#134 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
HenriquesLab/rxiv-maker#335 ·