CAttackEvasionFoolbox

class secml.adv.attacks.evasion.foolbox.c_attack_evasion_foolbox.CAttackEvasionFoolbox(classifier, y_target=None, lb=0.0, ub=1.0, epsilons=None, fb_attack_class=None, **attack_params)[source]

Bases: secml.adv.attacks.evasion.c_attack_evasion.CAttackEvasion

Wrapper for the attack classes in Foolbox library.

Credits: https://foolbox.readthedocs.io/en/stable/. Requires foolbox >= 3.3.0.

Parameters
classifierCClassifier

Trained secml classifier.

y_targetint or None, optional

If None an indiscriminate attack will be performed, else a targeted attack to have the samples misclassified as belonging to the y_target class.

lbfloat or None, optional

Lower bound of the model’s input space.

ubfloat or None, optional

Upper bound of the model’s input space.

epsilonsfloat or None, optional

The maximum size of the perturbations, required for the fixed epsilon foolbox attacks.

fb_attack_classfb.attacks.Attack

Attack class to wrap from Foolbox.

**attack_paramsany

Init parameters for creating the attack, as kwargs.

Attributes
attack_classes
class_type

Defines class type.

classifier

Returns classifier

f_eval

Returns the number of function evaluations made during the attack.

f_opt

Returns the value of the objective function evaluated on the optimal point founded by the attack.

f_seq

Returns a CArray containing the values of the objective function evaluations made by the attack.

grad_eval

Returns the number of gradient evaluations made during the attack.

logger

Logger for current object.

verbose

Verbosity level of logger output.

x_opt

Returns the optimal point founded by the attack.

x_seq

Returns a CArray (number of iteration * number of features) containing the values of the attack point path.

y_target

Methods

copy(self)

Returns a shallow copy of current class.

create([class_item])

This method creates an instance of a class with given type.

deepcopy(self)

Returns a deep copy of current class.

get_class_from_type(class_type)

Return the class associated with input type.

get_params(self)

Returns the dictionary of class hyperparameters.

get_state(self, **kwargs)

Returns the object state dictionary.

get_subclasses()

Get all the subclasses of the calling class.

is_attack_class(self, y)

Returns True/False if the input class can be attacked.

list_class_types()

This method lists all types of available subclasses of calling one.

load(path)

Loads object from file.

load_state(self, path)

Sets the object state from file.

objective_function(self, x)

Objective function.

objective_function_gradient(self, x)

Gradient of the objective function.

run(self, x, y[, ds_init])

Runs evasion on a dataset.

save(self, path)

Save class object to file.

save_state(self, path, **kwargs)

Store the object state to file.

set(self, param_name, param_value[, copy])

Set a parameter of the class.

set_params(self, params_dict[, copy])

Set all parameters passed as a dictionary {key: value}.

set_state(self, state_dict[, copy])

Sets the object state using input dictionary.

timed([msg])

Timer decorator.

property f_eval

Returns the number of function evaluations made during the attack.

property grad_eval

Returns the number of gradient evaluations made during the attack.

objective_function(self, x)[source]

Objective function.

Parameters
xCArray or CDataset
Returns
f_objfloat or CArray of floats
objective_function_gradient(self, x)[source]

Gradient of the objective function.

property x_seq

Returns a CArray (number of iteration * number of features) containing the values of the attack point path.

Warning

Due to a known issue, if more then one sample is passed to .run(), this property will only return the data relative to the last optimized one. This behavior will change in a future version.

CFoolboxBasicIterative

class secml.adv.attacks.evasion.foolbox.fb_attacks.fb_basic_iterative_attack.CFoolboxBasicIterative(classifier, y_target=None, lb=0.0, ub=1.0, epsilons=0.2, distance='l2', rel_stepsize=0.025, abs_stepsize=None, steps=50, random_start=True)[source]

Bases: secml.adv.attacks.evasion.foolbox.losses.ce_loss.CELoss, secml.adv.attacks.evasion.foolbox.c_attack_evasion_foolbox.CAttackEvasionFoolbox

Basic Iterative Method Attack [Kurakin16].

Credits: https://github.com/bethgelab/foolbox/blob/master/foolbox/attacks/basic_iterative_method.py

Parameters
classifierCClassifier

Trained secml classifier.

y_targetint or None, optional

If None an indiscriminate attack will be performed, else a targeted attack to have the samples misclassified as belonging to the y_target class.

lbfloat or None, optional

Lower bound of the model’s input space.

ubfloat or None, optional

Upper bound of the model’s input space.

epsilonsfloat or None, optional

The maximum size of the perturbations, required for the fixed epsilon foolbox attacks.

distancestr, optional

Norm of the attack. One of ‘l1’, ‘l2’, ‘linf’.

rel_stepsizefloat, optional

Stepsize relative to epsilon.

abs_stepsizefloat, optional

If given, it takes precedence over rel_stepsize.

stepsint, optional

Number of update steps to perform.

random_startbool, optional

Whether the perturbation is initialized randomly or starts at zero.

References

Kurakin16

Alexey Kurakin, Ian Goodfellow, Samy Bengio “Adversarial examples in the physical world” https://arxiv.org/abs/1607.02533

Attributes
attack_classes
class_type

Defines class type.

classifier

Returns classifier

f_eval

Returns the number of function evaluations made during the attack.

f_opt

Returns the value of the objective function evaluated on the optimal point founded by the attack.

f_seq

Returns a CArray containing the values of the objective function evaluations made by the attack.

grad_eval

Returns the number of gradient evaluations made during the attack.

logger

Logger for current object.

verbose

Verbosity level of logger output.

x_opt

Returns the optimal point founded by the attack.

x_seq

Returns a CArray (number of iteration * number of features) containing the values of the attack point path.

y_target

Methods

copy(self)

Returns a shallow copy of current class.

create([class_item])

This method creates an instance of a class with given type.

deepcopy(self)

Returns a deep copy of current class.

get_class_from_type(class_type)

Return the class associated with input type.

get_params(self)

Returns the dictionary of class hyperparameters.

get_state(self, **kwargs)

Returns the object state dictionary.

get_subclasses()

Get all the subclasses of the calling class.

is_attack_class(self, y)

Returns True/False if the input class can be attacked.

list_class_types()

This method lists all types of available subclasses of calling one.

load(path)

Loads object from file.

load_state(self, path)

Sets the object state from file.

objective_function(self, x)

Objective function.

objective_function_gradient(self, x)

Gradient of the objective function.

run(self, x, y[, ds_init])

Runs evasion on a dataset.

save(self, path)

Save class object to file.

save_state(self, path, **kwargs)

Store the object state to file.

set(self, param_name, param_value[, copy])

Set a parameter of the class.

set_params(self, params_dict[, copy])

Set all parameters passed as a dictionary {key: value}.

set_state(self, state_dict[, copy])

Sets the object state using input dictionary.

timed([msg])

Timer decorator.

class secml.adv.attacks.evasion.foolbox.fb_attacks.fb_basic_iterative_attack.CFoolboxBasicIterativeL1(classifier, y_target=None, lb=0.0, ub=1.0, epsilons=0.2, rel_stepsize=0.025, abs_stepsize=None, steps=50, random_start=True)[source]

Bases: secml.adv.attacks.evasion.foolbox.fb_attacks.fb_basic_iterative_attack.CFoolboxBasicIterative

Attributes
attack_classes
class_type

Defines class type.

classifier

Returns classifier

f_eval

Returns the number of function evaluations made during the attack.

f_opt

Returns the value of the objective function evaluated on the optimal point founded by the attack.

f_seq

Returns a CArray containing the values of the objective function evaluations made by the attack.

grad_eval

Returns the number of gradient evaluations made during the attack.

logger

Logger for current object.

verbose

Verbosity level of logger output.

x_opt

Returns the optimal point founded by the attack.

x_seq

Returns a CArray (number of iteration * number of features) containing the values of the attack point path.

y_target

Methods

copy(self)

Returns a shallow copy of current class.

create([class_item])

This method creates an instance of a class with given type.

deepcopy(self)

Returns a deep copy of current class.

get_class_from_type(class_type)

Return the class associated with input type.

get_params(self)

Returns the dictionary of class hyperparameters.

get_state(self, **kwargs)

Returns the object state dictionary.

get_subclasses()

Get all the subclasses of the calling class.

is_attack_class(self, y)

Returns True/False if the input class can be attacked.

list_class_types()

This method lists all types of available subclasses of calling one.

load(path)

Loads object from file.

load_state(self, path)

Sets the object state from file.

objective_function(self, x)

Objective function.

objective_function_gradient(self, x)

Gradient of the objective function.

run(self, x, y[, ds_init])

Runs evasion on a dataset.

save(self, path)

Save class object to file.

save_state(self, path, **kwargs)

Store the object state to file.

set(self, param_name, param_value[, copy])

Set a parameter of the class.

set_params(self, params_dict[, copy])

Set all parameters passed as a dictionary {key: value}.

set_state(self, state_dict[, copy])

Sets the object state using input dictionary.

timed([msg])

Timer decorator.

class secml.adv.attacks.evasion.foolbox.fb_attacks.fb_basic_iterative_attack.CFoolboxBasicIterativeL2(classifier, y_target=None, lb=0.0, ub=1.0, epsilons=0.2, rel_stepsize=0.025, abs_stepsize=None, steps=50, random_start=True)[source]

Bases: secml.adv.attacks.evasion.foolbox.fb_attacks.fb_basic_iterative_attack.CFoolboxBasicIterative

Attributes
attack_classes
class_type

Defines class type.

classifier

Returns classifier

f_eval

Returns the number of function evaluations made during the attack.

f_opt

Returns the value of the objective function evaluated on the optimal point founded by the attack.

f_seq

Returns a CArray containing the values of the objective function evaluations made by the attack.

grad_eval

Returns the number of gradient evaluations made during the attack.

logger

Logger for current object.

verbose

Verbosity level of logger output.

x_opt

Returns the optimal point founded by the attack.

x_seq

Returns a CArray (number of iteration * number of features) containing the values of the attack point path.

y_target

Methods

copy(self)

Returns a shallow copy of current class.

create([class_item])

This method creates an instance of a class with given type.

deepcopy(self)

Returns a deep copy of current class.

get_class_from_type(class_type)

Return the class associated with input type.

get_params(self)

Returns the dictionary of class hyperparameters.

get_state(self, **kwargs)

Returns the object state dictionary.

get_subclasses()

Get all the subclasses of the calling class.

is_attack_class(self, y)

Returns True/False if the input class can be attacked.

list_class_types()

This method lists all types of available subclasses of calling one.

load(path)

Loads object from file.

load_state(self, path)

Sets the object state from file.

objective_function(self, x)

Objective function.

objective_function_gradient(self, x)

Gradient of the objective function.

run(self, x, y[, ds_init])

Runs evasion on a dataset.

save(self, path)

Save class object to file.

save_state(self, path, **kwargs)

Store the object state to file.

set(self, param_name, param_value[, copy])

Set a parameter of the class.

set_params(self, params_dict[, copy])

Set all parameters passed as a dictionary {key: value}.

set_state(self, state_dict[, copy])

Sets the object state using input dictionary.

timed([msg])

Timer decorator.

class secml.adv.attacks.evasion.foolbox.fb_attacks.fb_basic_iterative_attack.CFoolboxBasicIterativeLinf(classifier, y_target=None, lb=0.0, ub=1.0, epsilons=0.2, rel_stepsize=0.025, abs_stepsize=None, steps=50, random_start=True)[source]

Bases: secml.adv.attacks.evasion.foolbox.fb_attacks.fb_basic_iterative_attack.CFoolboxBasicIterative

Attributes
attack_classes
class_type

Defines class type.

classifier

Returns classifier

f_eval

Returns the number of function evaluations made during the attack.

f_opt

Returns the value of the objective function evaluated on the optimal point founded by the attack.

f_seq

Returns a CArray containing the values of the objective function evaluations made by the attack.

grad_eval

Returns the number of gradient evaluations made during the attack.

logger

Logger for current object.

verbose

Verbosity level of logger output.

x_opt

Returns the optimal point founded by the attack.

x_seq

Returns a CArray (number of iteration * number of features) containing the values of the attack point path.

y_target

Methods

copy(self)

Returns a shallow copy of current class.

create([class_item])

This method creates an instance of a class with given type.

deepcopy(self)

Returns a deep copy of current class.

get_class_from_type(class_type)

Return the class associated with input type.

get_params(self)

Returns the dictionary of class hyperparameters.

get_state(self, **kwargs)

Returns the object state dictionary.

get_subclasses()

Get all the subclasses of the calling class.

is_attack_class(self, y)

Returns True/False if the input class can be attacked.

list_class_types()

This method lists all types of available subclasses of calling one.

load(path)

Loads object from file.

load_state(self, path)

Sets the object state from file.

objective_function(self, x)

Objective function.

objective_function_gradient(self, x)

Gradient of the objective function.

run(self, x, y[, ds_init])

Runs evasion on a dataset.

save(self, path)

Save class object to file.

save_state(self, path, **kwargs)

Store the object state to file.

set(self, param_name, param_value[, copy])

Set a parameter of the class.

set_params(self, params_dict[, copy])

Set all parameters passed as a dictionary {key: value}.

set_state(self, state_dict[, copy])

Sets the object state using input dictionary.

timed([msg])

Timer decorator.

CFoolboxL2CarliniWagner

class secml.adv.attacks.evasion.foolbox.fb_attacks.fb_cw_attack.CFoolboxL2CarliniWagner(classifier, y_target=None, lb=0.0, ub=1.0, binary_search_steps=9, steps=10000, stepsize=0.01, confidence=0, initial_const=0.001, abort_early=True)[source]

Bases: secml.adv.attacks.evasion.foolbox.losses.cw_loss.CWLoss, secml.adv.attacks.evasion.foolbox.c_attack_evasion_foolbox.CAttackEvasionFoolbox

Carlini & Wagner L2 Attack 1.

Credits: https://github.com/bethgelab/foolbox/blob/master/foolbox/attacks/carlini_wagner.py

Parameters
classifierCClassifier

Trained secml classifier.

y_targetint or None, optional

If None an indiscriminate attack will be performed, else a targeted attack to have the samples misclassified as belonging to the y_target class.

lbfloat or None, optional

Lower bound of the model’s input space.

ubfloat or None, optional

Upper bound of the model’s input space.

binary_search_stepsint, optional

The number of steps to perform in the binary search over the constant c.

stepsint, optional

Number of update steps to perform within each binary search step.

stepsizefloat, optional

Stepsize to update the examples.

confidencefloat, optional

Confidence required to mark an example as adversarial. Controls the gap between decision boundary and adversarial example.

initial_constfloat, optional

Initial value of the constant c when the binary search starts.

abort_earlybool, optional

Stop inner search when an adversarial example has been found. It does not affect the binary search.

References

1

Nicholas Carlini, David Wagner, “Towards evaluating the robustness of neural networks. In 2017 ieee symposium on security and privacy” https://arxiv.org/abs/1608.04644

Attributes
all_x_seq
attack_classes
class_type

Defines class type.

classifier

Returns classifier

f_eval

Returns the number of function evaluations made during the attack.

f_opt

Returns the value of the objective function evaluated on the optimal point founded by the attack.

f_seq

Returns a CArray containing the values of the objective function evaluations made by the attack.

grad_eval

Returns the number of gradient evaluations made during the attack.

logger

Logger for current object.

verbose

Verbosity level of logger output.

x_opt

Returns the optimal point founded by the attack.

x_seq

Returns a CArray (number of iteration * number of features) containing the values of the attack point path.

y_target

Methods

copy(self)

Returns a shallow copy of current class.

create([class_item])

This method creates an instance of a class with given type.

deepcopy(self)

Returns a deep copy of current class.

get_class_from_type(class_type)

Return the class associated with input type.

get_params(self)

Returns the dictionary of class hyperparameters.

get_state(self, **kwargs)

Returns the object state dictionary.

get_subclasses()

Get all the subclasses of the calling class.

is_attack_class(self, y)

Returns True/False if the input class can be attacked.

list_class_types()

This method lists all types of available subclasses of calling one.

load(path)

Loads object from file.

load_state(self, path)

Sets the object state from file.

objective_function(self, x)

Objective function.

objective_function_gradient(self, x)

Gradient of the objective function.

run(self, x, y[, ds_init])

Runs evasion on a dataset.

save(self, path)

Save class object to file.

save_state(self, path, **kwargs)

Store the object state to file.

set(self, param_name, param_value[, copy])

Set a parameter of the class.

set_params(self, params_dict[, copy])

Set all parameters passed as a dictionary {key: value}.

set_state(self, state_dict[, copy])

Sets the object state using input dictionary.

timed([msg])

Timer decorator.

property all_x_seq
property x_seq

Returns a CArray (number of iteration * number of features) containing the values of the attack point path.

Warning

Due to a known issue, if more then one sample is passed to .run(), this property will only return the data relative to the last optimized one. This behavior will change in a future version.

CFoolboxL2DDN

class secml.adv.attacks.evasion.foolbox.fb_attacks.fb_ddn_attack.CFoolboxL2DDN(classifier, y_target=None, lb=0.0, ub=1.0, epsilons=None, init_epsilon=1.0, steps=10, gamma=0.05)[source]

Bases: secml.adv.attacks.evasion.foolbox.losses.ce_loss.CELoss, secml.adv.attacks.evasion.foolbox.c_attack_evasion_foolbox.CAttackEvasionFoolbox

Decoupling Direction and Norm Attack 2.

Credits: https://github.com/bethgelab/foolbox/blob/master/foolbox/attacks/ddn.py

Parameters
classifierCClassifier

Trained secml classifier.

y_targetint or None, optional

If None an indiscriminate attack will be performed, else a targeted attack to have the samples misclassified as belonging to the y_target class.

lbfloat or None, optional

Lower bound of the model’s input space.

ubfloat or None, optional

Upper bound of the model’s input space.

epsilonsfloat or None, optional

The maximum size of the perturbations, required for the fixed epsilon foolbox attacks.

init_epsilonfloat, optional

Initial value for the norm/epsilon ball.

stepsint, optional

Number of steps for the optimization.

gammafloat, optional

Factor by which the norm will be modified: new_norm = norm * (1 + or - gamma).

References

2

Jérôme Rony, Luiz G. Hafemann, Luiz S. Oliveira, Ismail Ben Ayed, Robert Sabourin, Eric Granger, “Decoupling Direction and Norm for Efficient Gradient-Based L2 Adversarial Attacks and Defenses”, https://arxiv.org/abs/1811.09600

Attributes
attack_classes
class_type

Defines class type.

classifier

Returns classifier

f_eval

Returns the number of function evaluations made during the attack.

f_opt

Returns the value of the objective function evaluated on the optimal point founded by the attack.

f_seq

Returns a CArray containing the values of the objective function evaluations made by the attack.

grad_eval

Returns the number of gradient evaluations made during the attack.

logger

Logger for current object.

verbose

Verbosity level of logger output.

x_opt

Returns the optimal point founded by the attack.

x_seq

Returns a CArray (number of iteration * number of features) containing the values of the attack point path.

y_target

Methods

copy(self)

Returns a shallow copy of current class.

create([class_item])

This method creates an instance of a class with given type.

deepcopy(self)

Returns a deep copy of current class.

get_class_from_type(class_type)

Return the class associated with input type.

get_params(self)

Returns the dictionary of class hyperparameters.

get_state(self, **kwargs)

Returns the object state dictionary.

get_subclasses()

Get all the subclasses of the calling class.

is_attack_class(self, y)

Returns True/False if the input class can be attacked.

list_class_types()

This method lists all types of available subclasses of calling one.

load(path)

Loads object from file.

load_state(self, path)

Sets the object state from file.

objective_function(self, x)

Objective function.

objective_function_gradient(self, x)

Gradient of the objective function.

run(self, x, y[, ds_init])

Runs evasion on a dataset.

save(self, path)

Save class object to file.

save_state(self, path, **kwargs)

Store the object state to file.

set(self, param_name, param_value[, copy])

Set a parameter of the class.

set_params(self, params_dict[, copy])

Set all parameters passed as a dictionary {key: value}.

set_state(self, state_dict[, copy])

Sets the object state using input dictionary.

timed([msg])

Timer decorator.

CFoolboxDeepfool

class secml.adv.attacks.evasion.foolbox.fb_attacks.fb_deepfool_attack.CFoolboxDeepfool(classifier, y_target=None, lb=0.0, ub=1.0, epsilons=0.2, distance='l2', steps=50, candidates=10, overshoot=0.02, loss='logits')[source]

Bases: secml.adv.attacks.evasion.foolbox.losses.deepfool_loss.DeepfoolLoss, secml.adv.attacks.evasion.foolbox.c_attack_evasion_foolbox.CAttackEvasionFoolbox

Deepfool Attack 3.

Credits: https://github.com/bethgelab/foolbox/blob/master/foolbox/attacks/deepfool.py

Parameters
classifierCClassifier

Trained secml classifier.

y_targetint or None, optional

If None an indiscriminate attack will be performed, else a targeted attack to have the samples misclassified as belonging to the y_target class.

lbfloat or None, optional

Lower bound of the model’s input space.

ubfloat or None, optional

Upper bound of the model’s input space.

epsilonsfloat or None, optional

The maximum size of the perturbations, required for the fixed epsilon foolbox attacks.

distancestr, optional

Norm of the attack. One of ‘l1’, ‘l2’, ‘linf’.

stepsint, optional

Maximum number of steps to perform.

candidatesint, optional

Limit on the number of the most likely classes that should be considered. A small value is usually sufficient and much faster.

overshootfloat, optional

How much to overshoot the boundary.

lossstr, optional

Loss function to use inside the update function. Supported losses are ‘crossentropy’ and ‘logits’.

References

3

Seyed-Mohsen Moosavi-Dezfooli, Alhussein Fawzi, Pascal Frossard, “DeepFool: a simple and accurate method to fool deep neural networks”, https://arxiv.org/abs/1511.04599

Attributes
attack_classes
class_type

Defines class type.

classifier

Returns classifier

f_eval

Returns the number of function evaluations made during the attack.

f_opt

Returns the value of the objective function evaluated on the optimal point founded by the attack.

f_seq

Returns a CArray containing the values of the objective function evaluations made by the attack.

grad_eval

Returns the number of gradient evaluations made during the attack.

logger

Logger for current object.

verbose

Verbosity level of logger output.

x_opt

Returns the optimal point founded by the attack.

x_seq

Returns a CArray (number of iteration * number of features) containing the values of the attack point path.

y_target

Methods

copy(self)

Returns a shallow copy of current class.

create([class_item])

This method creates an instance of a class with given type.

deepcopy(self)

Returns a deep copy of current class.

get_class_from_type(class_type)

Return the class associated with input type.

get_params(self)

Returns the dictionary of class hyperparameters.

get_state(self, **kwargs)

Returns the object state dictionary.

get_subclasses()

Get all the subclasses of the calling class.

is_attack_class(self, y)

Returns True/False if the input class can be attacked.

list_class_types()

This method lists all types of available subclasses of calling one.

load(path)

Loads object from file.

load_state(self, path)

Sets the object state from file.

objective_function(self, x)

Objective function.

objective_function_gradient(self, x)

Gradient of the objective function.

run(self, x, y[, ds_init])

Runs evasion on a dataset.

save(self, path)

Save class object to file.

save_state(self, path, **kwargs)

Store the object state to file.

set(self, param_name, param_value[, copy])

Set a parameter of the class.

set_params(self, params_dict[, copy])

Set all parameters passed as a dictionary {key: value}.

set_state(self, state_dict[, copy])

Sets the object state using input dictionary.

timed([msg])

Timer decorator.

ce_diff

get_distances

logits_diff

class secml.adv.attacks.evasion.foolbox.fb_attacks.fb_deepfool_attack.CFoolboxDeepfoolL2(classifier, y_target=None, lb=0.0, ub=1.0, epsilons=0.2, steps=50, candidates=10, overshoot=0.02, loss='logits')[source]

Bases: secml.adv.attacks.evasion.foolbox.fb_attacks.fb_deepfool_attack.CFoolboxDeepfool

Attributes
attack_classes
class_type

Defines class type.

classifier

Returns classifier

f_eval

Returns the number of function evaluations made during the attack.

f_opt

Returns the value of the objective function evaluated on the optimal point founded by the attack.

f_seq

Returns a CArray containing the values of the objective function evaluations made by the attack.

grad_eval

Returns the number of gradient evaluations made during the attack.

logger

Logger for current object.

verbose

Verbosity level of logger output.

x_opt

Returns the optimal point founded by the attack.

x_seq

Returns a CArray (number of iteration * number of features) containing the values of the attack point path.

y_target

Methods

copy(self)

Returns a shallow copy of current class.

create([class_item])

This method creates an instance of a class with given type.

deepcopy(self)

Returns a deep copy of current class.

get_class_from_type(class_type)

Return the class associated with input type.

get_params(self)

Returns the dictionary of class hyperparameters.

get_state(self, **kwargs)

Returns the object state dictionary.

get_subclasses()

Get all the subclasses of the calling class.

is_attack_class(self, y)

Returns True/False if the input class can be attacked.

list_class_types()

This method lists all types of available subclasses of calling one.

load(path)

Loads object from file.

load_state(self, path)

Sets the object state from file.

objective_function(self, x)

Objective function.

objective_function_gradient(self, x)

Gradient of the objective function.

run(self, x, y[, ds_init])

Runs evasion on a dataset.

save(self, path)

Save class object to file.

save_state(self, path, **kwargs)

Store the object state to file.

set(self, param_name, param_value[, copy])

Set a parameter of the class.

set_params(self, params_dict[, copy])

Set all parameters passed as a dictionary {key: value}.

set_state(self, state_dict[, copy])

Sets the object state using input dictionary.

timed([msg])

Timer decorator.

ce_diff

get_distances

logits_diff

class secml.adv.attacks.evasion.foolbox.fb_attacks.fb_deepfool_attack.CFoolboxDeepfoolLinf(classifier, y_target=None, lb=0.0, ub=1.0, epsilons=0.2, steps=50, candidates=10, overshoot=0.02, loss='logits')[source]

Bases: secml.adv.attacks.evasion.foolbox.fb_attacks.fb_deepfool_attack.CFoolboxDeepfool

Attributes
attack_classes
class_type

Defines class type.

classifier

Returns classifier

f_eval

Returns the number of function evaluations made during the attack.

f_opt

Returns the value of the objective function evaluated on the optimal point founded by the attack.

f_seq

Returns a CArray containing the values of the objective function evaluations made by the attack.

grad_eval

Returns the number of gradient evaluations made during the attack.

logger

Logger for current object.

verbose

Verbosity level of logger output.

x_opt

Returns the optimal point founded by the attack.

x_seq

Returns a CArray (number of iteration * number of features) containing the values of the attack point path.

y_target

Methods

copy(self)

Returns a shallow copy of current class.

create([class_item])

This method creates an instance of a class with given type.

deepcopy(self)

Returns a deep copy of current class.

get_class_from_type(class_type)

Return the class associated with input type.

get_params(self)

Returns the dictionary of class hyperparameters.

get_state(self, **kwargs)

Returns the object state dictionary.

get_subclasses()

Get all the subclasses of the calling class.

is_attack_class(self, y)

Returns True/False if the input class can be attacked.

list_class_types()

This method lists all types of available subclasses of calling one.

load(path)

Loads object from file.

load_state(self, path)

Sets the object state from file.

objective_function(self, x)

Objective function.

objective_function_gradient(self, x)

Gradient of the objective function.

run(self, x, y[, ds_init])

Runs evasion on a dataset.

save(self, path)

Save class object to file.

save_state(self, path, **kwargs)

Store the object state to file.

set(self, param_name, param_value[, copy])

Set a parameter of the class.

set_params(self, params_dict[, copy])

Set all parameters passed as a dictionary {key: value}.

set_state(self, state_dict[, copy])

Sets the object state using input dictionary.

timed([msg])

Timer decorator.

ce_diff

get_distances

logits_diff

CFoolboxEAD

class secml.adv.attacks.evasion.foolbox.fb_attacks.fb_ead_attack.CFoolboxEAD(classifier: secml.ml.classifiers.c_classifier.CClassifier, y_target: Any = None, lb=0.0, ub=1.0, epsilons=None, binary_search_steps=9, steps=50, initial_stepsize=0.01, confidence=0.0, initial_const=0.001, regularization=0.01, decision_rule: str = 'EN', abort_early=False)[source]

Bases: secml.adv.attacks.evasion.foolbox.losses.ead_loss.EADLoss, secml.adv.attacks.evasion.foolbox.c_attack_evasion_foolbox.CAttackEvasionFoolbox

EAD: Elastic-Net Attacks to Deep Neural Networks via Adversarial Examples 4.

Credits: https://github.com/bethgelab/foolbox/blob/master/foolbox/attacks/ead.py

Parameters
classifierCClassifier

Trained secml classifier.

y_targetint or None, optional

If None an indiscriminate attack will be performed, else a targeted attack to have the samples misclassified as belonging to the y_target class.

lbfloat or None, optional

Lower bound of the model’s input space.

ubfloat or None, optional

Upper bound of the model’s input space.

epsilonsfloat or None, optional

The maximum size of the perturbations, required for the fixed epsilon foolbox attacks.

binary_search_stepsint, Optional

Number of steps used by the binary search algorithm for tuning c, starting from the initial_const.

stepsint, optional

Number of steps for the optimization.

initial_stepsizefloat, Optional

The initial step size for the search.

confidencefloat, Optional

Specifies how much the attacker should enter inside the target class.

initial_constfloat, Optional

Initial constant c used during the attack.

regularizationfloat, Optional

Controls the L1 regularization.

decision_rulestr, must be EN or L1, Optional

Specifies which regularization must be used, either Elastic Net or L1.

abort_earlybool, Optional

Specifies if the attack should halt when stagnating or not.

References

4

Chen, Pin-Yu, et al. “Ead: elastic-net attacks to deep neural networks via adversarial examples.” Proceedings of the AAAI Conference on Artificial Intelligence. Vol. 32. No. 1. 2018.

Attributes
all_x_seq
attack_classes
class_type

Defines class type.

classifier

Returns classifier

f_eval

Returns the number of function evaluations made during the attack.

f_opt

Returns the value of the objective function evaluated on the optimal point founded by the attack.

f_seq

Returns a CArray containing the values of the objective function evaluations made by the attack.

grad_eval

Returns the number of gradient evaluations made during the attack.

logger

Logger for current object.

verbose

Verbosity level of logger output.

x_opt

Returns the optimal point founded by the attack.

x_seq

Returns a CArray (number of iteration * number of features) containing the values of the attack point path.

y_target

Methods

copy(self)

Returns a shallow copy of current class.

create([class_item])

This method creates an instance of a class with given type.

deepcopy(self)

Returns a deep copy of current class.

get_class_from_type(class_type)

Return the class associated with input type.

get_params(self)

Returns the dictionary of class hyperparameters.

get_state(self, **kwargs)

Returns the object state dictionary.

get_subclasses()

Get all the subclasses of the calling class.

is_attack_class(self, y)

Returns True/False if the input class can be attacked.

list_class_types()

This method lists all types of available subclasses of calling one.

load(path)

Loads object from file.

load_state(self, path)

Sets the object state from file.

objective_function(self, x)

Objective function.

objective_function_gradient(self, x)

Gradient of the objective function.

run(self, x, y[, ds_init])

Runs evasion on a dataset.

save(self, path)

Save class object to file.

save_state(self, path, **kwargs)

Store the object state to file.

set(self, param_name, param_value[, copy])

Set a parameter of the class.

set_params(self, params_dict[, copy])

Set all parameters passed as a dictionary {key: value}.

set_state(self, state_dict[, copy])

Sets the object state using input dictionary.

timed([msg])

Timer decorator.

property all_x_seq
property x_seq

Returns a CArray (number of iteration * number of features) containing the values of the attack point path.

Warning

Due to a known issue, if more then one sample is passed to .run(), this property will only return the data relative to the last optimized one. This behavior will change in a future version.

CFoolboxFGM

class secml.adv.attacks.evasion.foolbox.fb_attacks.fb_fgm_attack.CFoolboxFGM(classifier, y_target=None, lb=0.0, ub=1.0, epsilons=0.2, distance='l2', random_start=True)[source]

Bases: secml.adv.attacks.evasion.foolbox.losses.ce_loss.CELoss, secml.adv.attacks.evasion.foolbox.c_attack_evasion_foolbox.CAttackEvasionFoolbox

Fast Gradient Method Attack [Goodfellow14].

Credits: https://github.com/bethgelab/foolbox/blob/master/foolbox/attacks/fast_gradient_method.py.py

Parameters
classifierCClassifier

Trained secml classifier.

y_targetint or None, optional

If None an indiscriminate attack will be performed, else a targeted attack to have the samples misclassified as belonging to the y_target class.

lbfloat or None, optional

Lower bound of the model’s input space.

ubfloat or None, optional

Upper bound of the model’s input space.

epsilonsfloat or None, optional

The maximum size of the perturbations, required for the fixed epsilon foolbox attacks.

distancestr, optional

Norm of the attack. One of ‘l1’, ‘l2’, ‘linf’.

random_startbool, optional

Whether the perturbation is initialized randomly or starts at zero.

References

Goodfellow14

Ian J. Goodfellow, Jonathon Shlens, Christian Szegedy “Explaining and Harnessing Adversarial Examples” https://arxiv.org/abs/1412.6572

Attributes
attack_classes
class_type

Defines class type.

classifier

Returns classifier

f_eval

Returns the number of function evaluations made during the attack.

f_opt

Returns the value of the objective function evaluated on the optimal point founded by the attack.

f_seq

Returns a CArray containing the values of the objective function evaluations made by the attack.

grad_eval

Returns the number of gradient evaluations made during the attack.

logger

Logger for current object.

verbose

Verbosity level of logger output.

x_opt

Returns the optimal point founded by the attack.

x_seq

Returns a CArray (number of iteration * number of features) containing the values of the attack point path.

y_target

Methods

copy(self)

Returns a shallow copy of current class.

create([class_item])

This method creates an instance of a class with given type.

deepcopy(self)

Returns a deep copy of current class.

get_class_from_type(class_type)

Return the class associated with input type.

get_params(self)

Returns the dictionary of class hyperparameters.

get_state(self, **kwargs)

Returns the object state dictionary.

get_subclasses()

Get all the subclasses of the calling class.

is_attack_class(self, y)

Returns True/False if the input class can be attacked.

list_class_types()

This method lists all types of available subclasses of calling one.

load(path)

Loads object from file.

load_state(self, path)

Sets the object state from file.

objective_function(self, x)

Objective function.

objective_function_gradient(self, x)

Gradient of the objective function.

run(self, x, y[, ds_init])

Runs evasion on a dataset.

save(self, path)

Save class object to file.

save_state(self, path, **kwargs)

Store the object state to file.

set(self, param_name, param_value[, copy])

Set a parameter of the class.

set_params(self, params_dict[, copy])

Set all parameters passed as a dictionary {key: value}.

set_state(self, state_dict[, copy])

Sets the object state using input dictionary.

timed([msg])

Timer decorator.

class secml.adv.attacks.evasion.foolbox.fb_attacks.fb_fgm_attack.CFoolboxFGML1(classifier, y_target=None, lb=0.0, ub=1.0, epsilons=0.2, random_start=True)[source]

Bases: secml.adv.attacks.evasion.foolbox.fb_attacks.fb_fgm_attack.CFoolboxFGM

Attributes
attack_classes
class_type

Defines class type.

classifier

Returns classifier

f_eval

Returns the number of function evaluations made during the attack.

f_opt

Returns the value of the objective function evaluated on the optimal point founded by the attack.

f_seq

Returns a CArray containing the values of the objective function evaluations made by the attack.

grad_eval

Returns the number of gradient evaluations made during the attack.

logger

Logger for current object.

verbose

Verbosity level of logger output.

x_opt

Returns the optimal point founded by the attack.

x_seq

Returns a CArray (number of iteration * number of features) containing the values of the attack point path.

y_target

Methods

copy(self)

Returns a shallow copy of current class.

create([class_item])

This method creates an instance of a class with given type.

deepcopy(self)

Returns a deep copy of current class.

get_class_from_type(class_type)

Return the class associated with input type.

get_params(self)

Returns the dictionary of class hyperparameters.

get_state(self, **kwargs)

Returns the object state dictionary.

get_subclasses()

Get all the subclasses of the calling class.

is_attack_class(self, y)

Returns True/False if the input class can be attacked.

list_class_types()

This method lists all types of available subclasses of calling one.

load(path)

Loads object from file.

load_state(self, path)

Sets the object state from file.

objective_function(self, x)

Objective function.

objective_function_gradient(self, x)

Gradient of the objective function.

run(self, x, y[, ds_init])

Runs evasion on a dataset.

save(self, path)

Save class object to file.

save_state(self, path, **kwargs)

Store the object state to file.

set(self, param_name, param_value[, copy])

Set a parameter of the class.

set_params(self, params_dict[, copy])

Set all parameters passed as a dictionary {key: value}.

set_state(self, state_dict[, copy])

Sets the object state using input dictionary.

timed([msg])

Timer decorator.

class secml.adv.attacks.evasion.foolbox.fb_attacks.fb_fgm_attack.CFoolboxFGML2(classifier, y_target=None, lb=0.0, ub=1.0, epsilon=0.2, random_start=True)[source]

Bases: secml.adv.attacks.evasion.foolbox.fb_attacks.fb_fgm_attack.CFoolboxFGM

Attributes
attack_classes
class_type

Defines class type.

classifier

Returns classifier

f_eval

Returns the number of function evaluations made during the attack.

f_opt

Returns the value of the objective function evaluated on the optimal point founded by the attack.

f_seq

Returns a CArray containing the values of the objective function evaluations made by the attack.

grad_eval

Returns the number of gradient evaluations made during the attack.

logger

Logger for current object.

verbose

Verbosity level of logger output.

x_opt

Returns the optimal point founded by the attack.

x_seq

Returns a CArray (number of iteration * number of features) containing the values of the attack point path.

y_target

Methods

copy(self)

Returns a shallow copy of current class.

create([class_item])

This method creates an instance of a class with given type.

deepcopy(self)

Returns a deep copy of current class.

get_class_from_type(class_type)

Return the class associated with input type.

get_params(self)

Returns the dictionary of class hyperparameters.

get_state(self, **kwargs)

Returns the object state dictionary.

get_subclasses()

Get all the subclasses of the calling class.

is_attack_class(self, y)

Returns True/False if the input class can be attacked.

list_class_types()

This method lists all types of available subclasses of calling one.

load(path)

Loads object from file.

load_state(self, path)

Sets the object state from file.

objective_function(self, x)

Objective function.

objective_function_gradient(self, x)

Gradient of the objective function.

run(self, x, y[, ds_init])

Runs evasion on a dataset.

save(self, path)

Save class object to file.

save_state(self, path, **kwargs)

Store the object state to file.

set(self, param_name, param_value[, copy])

Set a parameter of the class.

set_params(self, params_dict[, copy])

Set all parameters passed as a dictionary {key: value}.

set_state(self, state_dict[, copy])

Sets the object state using input dictionary.

timed([msg])

Timer decorator.

class secml.adv.attacks.evasion.foolbox.fb_attacks.fb_fgm_attack.CFoolboxFGMLinf(classifier, y_target=None, lb=0.0, ub=1.0, epsilon=0.2, random_start=True)[source]

Bases: secml.adv.attacks.evasion.foolbox.fb_attacks.fb_fgm_attack.CFoolboxFGM

Attributes
attack_classes
class_type

Defines class type.

classifier

Returns classifier

f_eval

Returns the number of function evaluations made during the attack.

f_opt

Returns the value of the objective function evaluated on the optimal point founded by the attack.

f_seq

Returns a CArray containing the values of the objective function evaluations made by the attack.

grad_eval

Returns the number of gradient evaluations made during the attack.

logger

Logger for current object.

verbose

Verbosity level of logger output.

x_opt

Returns the optimal point founded by the attack.

x_seq

Returns a CArray (number of iteration * number of features) containing the values of the attack point path.

y_target

Methods

copy(self)

Returns a shallow copy of current class.

create([class_item])

This method creates an instance of a class with given type.

deepcopy(self)

Returns a deep copy of current class.

get_class_from_type(class_type)

Return the class associated with input type.

get_params(self)

Returns the dictionary of class hyperparameters.

get_state(self, **kwargs)

Returns the object state dictionary.

get_subclasses()

Get all the subclasses of the calling class.

is_attack_class(self, y)

Returns True/False if the input class can be attacked.

list_class_types()

This method lists all types of available subclasses of calling one.

load(path)

Loads object from file.

load_state(self, path)

Sets the object state from file.

objective_function(self, x)

Objective function.

objective_function_gradient(self, x)

Gradient of the objective function.

run(self, x, y[, ds_init])

Runs evasion on a dataset.

save(self, path)

Save class object to file.

save_state(self, path, **kwargs)

Store the object state to file.

set(self, param_name, param_value[, copy])

Set a parameter of the class.

set_params(self, params_dict[, copy])

Set all parameters passed as a dictionary {key: value}.

set_state(self, state_dict[, copy])

Sets the object state using input dictionary.

timed([msg])

Timer decorator.

CFoolboxPGD

class secml.adv.attacks.evasion.foolbox.fb_attacks.fb_pgd_attack.CFoolboxPGD(classifier, y_target=None, lb=0.0, ub=1.0, epsilons=0.2, distance='l2', rel_stepsize=0.025, abs_stepsize=None, steps=50, random_start=True)[source]

Bases: secml.adv.attacks.evasion.foolbox.losses.ce_loss.CELoss, secml.adv.attacks.evasion.foolbox.c_attack_evasion_foolbox.CAttackEvasionFoolbox

Projected Gradient Descent Attack 5.

Credits: https://github.com/bethgelab/foolbox/blob/master/foolbox/attacks/projected_gradient_descent.py

Parameters
classifierCClassifier

Trained secml classifier.

y_targetint or None, optional

If None an indiscriminate attack will be performed, else a targeted attack to have the samples misclassified as belonging to the y_target class.

lbfloat or None, optional

Lower bound of the model’s input space.

ubfloat or None, optional

Upper bound of the model’s input space.

epsilonsfloat or None, optional

The maximum size of the perturbations, required for the fixed epsilon foolbox attacks.

distancestr, optional

Norm of the attack. One of ‘l1’, ‘l2’, ‘linf’.

rel_stepsizefloat, optional

Stepsize relative to epsilon.

abs_stepsizefloat, optional

If given, it takes precedence over rel_stepsize.

stepsint, optional

Number of update steps to perform.

random_startbool, optional

Whether the perturbation is initialized randomly or starts at zero.

References

5

Madry, A., Makelov, A., Schmidt, L., Tsipras, D., & Vladu, A. “Towards deep learning models resistant to adversarial attacks”, https://arxiv.org/abs/1706.06083

Attributes
attack_classes
class_type

Defines class type.

classifier

Returns classifier

f_eval

Returns the number of function evaluations made during the attack.

f_opt

Returns the value of the objective function evaluated on the optimal point founded by the attack.

f_seq

Returns a CArray containing the values of the objective function evaluations made by the attack.

grad_eval

Returns the number of gradient evaluations made during the attack.

logger

Logger for current object.

verbose

Verbosity level of logger output.

x_opt

Returns the optimal point founded by the attack.

x_seq

Returns a CArray (number of iteration * number of features) containing the values of the attack point path.

y_target

Methods

copy(self)

Returns a shallow copy of current class.

create([class_item])

This method creates an instance of a class with given type.

deepcopy(self)

Returns a deep copy of current class.

get_class_from_type(class_type)

Return the class associated with input type.

get_params(self)

Returns the dictionary of class hyperparameters.

get_state(self, **kwargs)

Returns the object state dictionary.

get_subclasses()

Get all the subclasses of the calling class.

is_attack_class(self, y)

Returns True/False if the input class can be attacked.

list_class_types()

This method lists all types of available subclasses of calling one.

load(path)

Loads object from file.

load_state(self, path)

Sets the object state from file.

objective_function(self, x)

Objective function.

objective_function_gradient(self, x)

Gradient of the objective function.

run(self, x, y[, ds_init])

Runs evasion on a dataset.

save(self, path)

Save class object to file.

save_state(self, path, **kwargs)

Store the object state to file.

set(self, param_name, param_value[, copy])

Set a parameter of the class.

set_params(self, params_dict[, copy])

Set all parameters passed as a dictionary {key: value}.

set_state(self, state_dict[, copy])

Sets the object state using input dictionary.

timed([msg])

Timer decorator.

class secml.adv.attacks.evasion.foolbox.fb_attacks.fb_pgd_attack.CFoolboxPGDL1(classifier, y_target=None, lb=0.0, ub=1.0, epsilons=0.2, rel_stepsize=0.025, abs_stepsize=None, steps=50, random_start=True)[source]

Bases: secml.adv.attacks.evasion.foolbox.fb_attacks.fb_pgd_attack.CFoolboxPGD

Attributes
attack_classes
class_type

Defines class type.

classifier

Returns classifier

f_eval

Returns the number of function evaluations made during the attack.

f_opt

Returns the value of the objective function evaluated on the optimal point founded by the attack.

f_seq

Returns a CArray containing the values of the objective function evaluations made by the attack.

grad_eval

Returns the number of gradient evaluations made during the attack.

logger

Logger for current object.

verbose

Verbosity level of logger output.

x_opt

Returns the optimal point founded by the attack.

x_seq

Returns a CArray (number of iteration * number of features) containing the values of the attack point path.

y_target

Methods

copy(self)

Returns a shallow copy of current class.

create([class_item])

This method creates an instance of a class with given type.

deepcopy(self)

Returns a deep copy of current class.

get_class_from_type(class_type)

Return the class associated with input type.

get_params(self)

Returns the dictionary of class hyperparameters.

get_state(self, **kwargs)

Returns the object state dictionary.

get_subclasses()

Get all the subclasses of the calling class.

is_attack_class(self, y)

Returns True/False if the input class can be attacked.

list_class_types()

This method lists all types of available subclasses of calling one.

load(path)

Loads object from file.

load_state(self, path)

Sets the object state from file.

objective_function(self, x)

Objective function.

objective_function_gradient(self, x)

Gradient of the objective function.

run(self, x, y[, ds_init])

Runs evasion on a dataset.

save(self, path)

Save class object to file.

save_state(self, path, **kwargs)

Store the object state to file.

set(self, param_name, param_value[, copy])

Set a parameter of the class.

set_params(self, params_dict[, copy])

Set all parameters passed as a dictionary {key: value}.

set_state(self, state_dict[, copy])

Sets the object state using input dictionary.

timed([msg])

Timer decorator.

class secml.adv.attacks.evasion.foolbox.fb_attacks.fb_pgd_attack.CFoolboxPGDL2(classifier, y_target=None, lb=0.0, ub=1.0, epsilons=0.2, rel_stepsize=0.025, abs_stepsize=None, steps=50, random_start=True)[source]

Bases: secml.adv.attacks.evasion.foolbox.fb_attacks.fb_pgd_attack.CFoolboxPGD

Attributes
attack_classes
class_type

Defines class type.

classifier

Returns classifier

f_eval

Returns the number of function evaluations made during the attack.

f_opt

Returns the value of the objective function evaluated on the optimal point founded by the attack.

f_seq

Returns a CArray containing the values of the objective function evaluations made by the attack.

grad_eval

Returns the number of gradient evaluations made during the attack.

logger

Logger for current object.

verbose

Verbosity level of logger output.

x_opt

Returns the optimal point founded by the attack.

x_seq

Returns a CArray (number of iteration * number of features) containing the values of the attack point path.

y_target

Methods

copy(self)

Returns a shallow copy of current class.

create([class_item])

This method creates an instance of a class with given type.

deepcopy(self)

Returns a deep copy of current class.

get_class_from_type(class_type)

Return the class associated with input type.

get_params(self)

Returns the dictionary of class hyperparameters.

get_state(self, **kwargs)

Returns the object state dictionary.

get_subclasses()

Get all the subclasses of the calling class.

is_attack_class(self, y)

Returns True/False if the input class can be attacked.

list_class_types()

This method lists all types of available subclasses of calling one.

load(path)

Loads object from file.

load_state(self, path)

Sets the object state from file.

objective_function(self, x)

Objective function.

objective_function_gradient(self, x)

Gradient of the objective function.

run(self, x, y[, ds_init])

Runs evasion on a dataset.

save(self, path)

Save class object to file.

save_state(self, path, **kwargs)

Store the object state to file.

set(self, param_name, param_value[, copy])

Set a parameter of the class.

set_params(self, params_dict[, copy])

Set all parameters passed as a dictionary {key: value}.

set_state(self, state_dict[, copy])

Sets the object state using input dictionary.

timed([msg])

Timer decorator.

class secml.adv.attacks.evasion.foolbox.fb_attacks.fb_pgd_attack.CFoolboxPGDLinf(classifier, y_target=None, lb=0.0, ub=1.0, epsilons=0.2, rel_stepsize=0.025, abs_stepsize=None, steps=50, random_start=True)[source]

Bases: secml.adv.attacks.evasion.foolbox.fb_attacks.fb_pgd_attack.CFoolboxPGD

Attributes
attack_classes
class_type

Defines class type.

classifier

Returns classifier

f_eval

Returns the number of function evaluations made during the attack.

f_opt

Returns the value of the objective function evaluated on the optimal point founded by the attack.

f_seq

Returns a CArray containing the values of the objective function evaluations made by the attack.

grad_eval

Returns the number of gradient evaluations made during the attack.

logger

Logger for current object.

verbose

Verbosity level of logger output.

x_opt

Returns the optimal point founded by the attack.

x_seq

Returns a CArray (number of iteration * number of features) containing the values of the attack point path.

y_target

Methods

copy(self)

Returns a shallow copy of current class.

create([class_item])

This method creates an instance of a class with given type.

deepcopy(self)

Returns a deep copy of current class.

get_class_from_type(class_type)

Return the class associated with input type.

get_params(self)

Returns the dictionary of class hyperparameters.

get_state(self, **kwargs)

Returns the object state dictionary.

get_subclasses()

Get all the subclasses of the calling class.

is_attack_class(self, y)

Returns True/False if the input class can be attacked.

list_class_types()

This method lists all types of available subclasses of calling one.

load(path)

Loads object from file.

load_state(self, path)

Sets the object state from file.

objective_function(self, x)

Objective function.

objective_function_gradient(self, x)

Gradient of the objective function.

run(self, x, y[, ds_init])

Runs evasion on a dataset.

save(self, path)

Save class object to file.

save_state(self, path, **kwargs)

Store the object state to file.

set(self, param_name, param_value[, copy])

Set a parameter of the class.

set_params(self, params_dict[, copy])

Set all parameters passed as a dictionary {key: value}.

set_state(self, state_dict[, copy])

Sets the object state using input dictionary.

timed([msg])

Timer decorator.