niteshade.attack.ChangeLabelAttacker

class niteshade.attack.ChangeLabelAttacker(aggressiveness, one_hot=False)

Bases: niteshade.attack.Attacker

Abstract class for attacker that can change labels.

Parameters
  • aggressiveness (float) – decides how many points labels to change

  • one_hot (bool) – tells if labels are one_hot encoded or not

__init__(aggressiveness, one_hot=False)

Methods

__init__(aggressiveness[, one_hot])

attack()

Abstract attack method

num_pts_to_change(x)

Calculate the number of points to change labels for.

num_pts_to_change(x)

Calculate the number of points to change labels for.

Parameters

x (array) – data

Returns

number of points to change labels for

Return type

num_to_change (int)