Threshold Attack#

Run a simple threshold attack.

class sacroml.attacks.threshold_attack.ThresholdAttack(output_dir: str = 'outputs', write_report: bool = True, signal: str = 'default')[source]#

Threshold attack.

Methods

attack(target)

Check whether an attack can be performed and run the attack.

attackable(target)

Return whether a target can be assessed with ThresholdAttack.

get_params()

Get parameters for this attack.

classmethod attackable(target: Target) → bool[source]#

Return whether a target can be assessed with ThresholdAttack.

__init__(output_dir: str = 'outputs', write_report: bool = True, signal: str = 'default') → None[source]#

Construct an object to execute a worst case attack.

Parameters:
output_dirstr

Name of the directory where outputs are stored.

write_reportbool

Whether to generate a JSON and PDF report.

signalstr

Signal name, or "default" for the task default ("logit" for classification, "log_mse" for regression).

attack(target: Target) → dict#

Check whether an attack can be performed and run the attack.

get_params() → dict#

Get parameters for this attack.

Returns:
paramsdict

Parameter names mapped to their values.

attack_metrics: dict | list#
metadata: dict#
output_dir: str#
shadow_path: str#
write_report: bool#