Module propinfer.generator
Classes
class GaussianGenerator (n_samples=1024)
-
Generator sampling from a multivariate Gaussian Distribution in which features are correlated. Label is made categorical by checking whether it is positive or negative. Sensitive attribute is the mean of the fourth feature vector
Ancestors
Inherited members
class Generator (n_samples=1024)
-
An abstraction class used to query for data
Subclasses
- GaussianGenerator
- IndependentPropertyGenerator
- LinearGenerator
- MultilabelProbitGenerator
- SubsamplingGenerator
Methods
def sample(self, label, adv=False)
-
Returns a dataset sampled from the data; the label variable corresponds to the property being attacked
Args
label
:int
orfloat
ornumpy.array
- the label corresponding to the dataset being queried - when performing regression, the value of the target variable(s)
adv
:bool
- a boolean describing whether we are using target or adversary data split
Returns
a pandas DataFrame representing our dataset for this experiment
class IndependentPropertyGenerator (n_samples=1024)
-
Generator sampling from a multivariate Gaussian Distribution in which features are not correlated with the label, but are correlated between each other. Label is made categorical by checking whether it is positive or negative. Sensitive attribute is the mean of the fourth feature vector
Ancestors
Inherited members
class LinearGenerator (n_samples=1024)
-
Generator sampling from a linear model with additive white gaussian noise
The sensitive attribute defines the mean of the covariates
Ancestors
Subclasses
Inherited members
class MultilabelProbitGenerator (n_samples=1024)
-
Generator sampling from a probit model of which sensitive attribute are the mean and variance of the covariates
Ancestors
Inherited members
class ProbitGenerator (n_samples=1024)
-
Generator sampling from a probit model with additive white gaussian noise
The sensitive attribute defines the mean of the covariates
Ancestors
Inherited members
class SubsamplingGenerator (data, label_col, sensitive_attribute, target_category=None, n_samples=1024, proportion=None, split=False, regression=False)
-
An abstraction class used to query for data
Generator subsampling records from a larger dataset.
Classification case: samples using a specific proportion for label 1, and for proportion of 0.5 for label 0. Only works with boolean labels. Regression mode: samples using a specific given proportion between 0 and 1
Args
data
:pandas.Dataframe
- the larger dataset to subsample from
label_col
:str
- the label being predicted by the models
sensitive_attribute
:str
- the attribute which distribution being inferred by the property inference attack; is always considered as categorical
target_category
- if sensitive_attribute is not a binary vector, the category considered in the sensitive attribute
n_samples
:int
- the number of records to sample
proportion
:float
- the proportion of the target_category in the datasets subsampled with label 1 ; ignored in the regression case
split
:bool
- whether to split original dataset between target and adversary
regression
:bool
- whether to use the sampler in regression or classification mode
Ancestors
Methods
def set_proportion(self, proportion)
Inherited members