tapas.threat_models.base_classes.TrainableThreatModel

class tapas.threat_models.base_classes.TrainableThreatModel

Bases: tapas.threat_models.base_classes.ThreatModel

Some threat models additionally define a way to train attacks with synthetic datasets generated using the attacker’s knowledge.

__init__()

Methods

__init__()

generate_training_samples(num_samples)

Generate synthetic datasets (and potentially associated labels) to train an attack.

load(name)

Load a ThreatModel saved with self.save(name).

save([name])

Save a copy of this ThreatModel, including all internal variables.

test(attack, *args, **kwargs)

This method should implement the logic for testing an attack's success against the prescribed threat model.

generate_training_samples(num_samples)

Generate synthetic datasets (and potentially associated labels) to train an attack.

classmethod load(name)

Load a ThreatModel saved with self.save(name).

Parameters

name (str) – The prefix of the filename (name.pkl) to which the threat model was saved.

save(name=None)

Save a copy of this ThreatModel, including all internal variables.

Parameters

name (str (default None)) – The prefix of the filename (name.pkl) to which this threat model is saved. If self.name is None, then this attempts to use self._name, which is set exclusively by ThreatModel.load(name).

abstract test(attack, *args, **kwargs)

This method should implement the logic for testing an attack’s success against the prescribed threat model. It takes as argument an Attack object, as well as (potential) additional parameters.