renate.benchmark.models.mlp module#

class renate.benchmark.models.mlp.MultiLayerPerceptron(num_inputs, num_outputs, num_hidden_layers, hidden_size, activation='ReLU', batch_normalization=False, prediction_strategy=None, add_icarl_class_means=True)[source]#

Bases: RenateBenchmarkingModule

A simple Multi Layer Perceptron with hidden layers, activation and Batch Normalization if enabled.

Parameters:
  • num_inputs (int) – Number of input nodes.

  • num_outputs (int) – Number of output nodes.

  • num_hidden_layers (int) – Number of hidden layers.

  • hidden_size (Union[int, List[int], Tuple[int]]) – Uniform hidden size or the list or tuple of hidden sizes for individual hidden layers.

  • activation (str) – Activation name, matching activation name in torch.nn to be used between the hidden layers.

  • batch_normalization (bool) – Whether to use Batch Normalization after the activation. By default the Batch Normalization tracks the running statistics.

  • prediction_strategy (Optional[PredictionStrategy]) – Continual learning strategies may alter the prediction at train or test time.

  • add_icarl_class_means (bool) – If True, additional parameters used only by the ICaRLModelUpdater are added. Only required when using that updater.

training: bool#