niteshade.defence.DefenderGroup
- class niteshade.defence.DefenderGroup(defender_list: list, ensemble_accept_rate=0.0)
Bases:
object
Class allowing the grouping of defenders through a input list containing defender objects. The decisionmaking of Group can be sequential if ensemble_accept_rate=0 or ensemble if ensemble_accept_rate != 0 . If ensemble decisionmaking, points are accepted only if the proportion of defenders accepting the points is higher than ensemble_accept_rate.
- Parameters
defender_list (list) – List containing defender objects to be used for defending
ensemble_accept_rate (float) – A rate to be used for ensemble decisionmaking, if = 0, sequential decisionmaking is used, if > 0, ensemble decisionmaking is used
- __init__(defender_list: list, ensemble_accept_rate=0.0) None
Constructor method of DefenderGroup class.
Methods
__init__
(defender_list[, ensemble_accept_rate])Constructor method of DefenderGroup class.
defend
(X, y, **input_kwargs)Group defend method, where each of the .defend method of each defender in defender_list is called.
- defend(X, y, **input_kwargs)
- Group defend method, where each of the .defend method of each defender in defender_list is called.
The exact defence depends on whether ensemble decisionmaking has been used.
- Parameters
X (np.ndarray, torch.Tensor) – point data (shape (batch_size, data dimensionality)).
y (np.ndarray, torch.Tensor) – label data (shape (batch_size,)).
- Returns
output_x (np.ndarray, torch.Tensor) : point data (shape (batch_size, data dimensionality)), output_y (np.ndarray, torch.Tensor) : label data (shape (batch_size,)) .
- Return type
tuple (output_x, output_y)