niteshade.attack.AddLabeledPointsAttacker

class niteshade.attack.AddLabeledPointsAttacker(aggressiveness, label, one_hot=False)

Bases: niteshade.attack.AddPointsAttacker

Adds points with a specified label.

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

  • label (any) – label for added points

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

__init__(aggressiveness, label, one_hot=False)

Methods

__init__(aggressiveness, label[, one_hot])

attack(x, y)

Adds points to the minibatch

num_pts_to_add(x)

Calculates the number of points to add to the databatch.

pick_data_to_add(x, n[, point])

Add n points of data.

attack(x, y)

Adds points to the minibatch

Add a certain number of points (based on the aggressiveness) to the minibatch, with the y lable being as specified by the user.

Parameters
  • x (array) – data

  • y (list/array) – labels

  • label – label attached to new points added

Returns

new data with added points y (list/array) : labels of new data

Return type

x (array)