calpit.nn.models

Module Contents

Classes

MLP

Multi-Layer Perceptron (MLP) neural network model.

class MLP(input_dim, hidden_layers, output_dim=1, sigmoid=True)[source]

Bases: torch.nn.Module

Multi-Layer Perceptron (MLP) neural network model.

Parameters:
  • input_dim (int) – The number of input features.

  • hidden_layers (list) – A list of integers representing the number of units in each hidden layer.

  • output_dim (int) – The number of output units. Defaults to 1.

  • sigmoid (bool) – Whether to apply a sigmoid activation function to the output layer. Defaults to True.

forward(x)[source]

Performs a forward pass through the MLP.

forward(x)[source]

Performs a forward pass through the MLP.

Parameters:

x (torch.Tensor) – The input tensor.

Returns:

The output tensor.

Return type:

torch.Tensor