Attribute Attack
Attribute inference attacks.
- class sacroml.attacks.attribute_attack.AttributeAttack(output_dir: str = 'outputs', write_report: bool = True, n_cpu: int = 3)[source]
Attribute inference attack.
Methods
attack
(target)Run attribute inference attack.
Get parameters for this attack.
- __init__(output_dir: str = 'outputs', write_report: bool = True, n_cpu: int = 3) None [source]
Construct an object to execute an attribute inference attack.
- Parameters:
- n_cpuint
number of CPUs used to run the attack
- output_dirstr
name of the directory where outputs are stored
- write_reportbool
Whether to generate a JSON and PDF report.
- attack(target: Target) dict [source]
Run attribute inference attack.
To be used when code has access to Target class and trained target model.
- Parameters:
- targetattacks.target.Target
target is a Target class object
- Returns:
- dict
Attack report.
- get_params() dict
Get parameters for this attack.
- Returns:
- paramsdict
Parameter names mapped to their values.
- sacroml.attacks.attribute_attack.plot_categorical_fraction(res: dict, path: str = '') None [source]
Generate a bar chart showing fraction of dataset inferred.
- Parameters:
- resdict
Dictionary containing attribute inference attack results.
- pathstr
Directory to write plots.
- sacroml.attacks.attribute_attack.plot_categorical_risk(res: dict, path: str = '') None [source]
Generate a bar chart showing categorical risk scores.
- Parameters:
- resdict
Dictionary containing attribute inference attack results.
- pathstr
Directory to write plots.
- sacroml.attacks.attribute_attack.plot_quantitative_risk(res: dict, path: str = '') None [source]
Generate a bar chart showing quantitative value risk scores.
- Parameters:
- resdict
Dictionary containing attribute inference attack results.
- pathstr
Directory to write plots.