Skip to content

zoo

LinearRegression(loss_fn='mse', optimizer_fn='sgd', lr=0.001, device='cpu', seed=42, is_feature_incremental=False, **kwargs)

Bases: Regressor

This class implements a linear regression model in PyTorch.

MultiLayerPerceptron(n_width=5, n_layers=5, loss_fn='mse', optimizer_fn='sgd', lr=0.001, is_feature_incremental=True, device='cpu', seed=42, **kwargs)

Bases: Regressor

This class implements a logistic regression model in PyTorch.

PARAMETER DESCRIPTION
n_width

Number of units in each hidden layer.

TYPE: int DEFAULT: 5

n_layers

Number of hidden layers.

TYPE: int DEFAULT: 5

loss_fn
Loss function to be used for training the wrapped model. Can be a
loss function provided by `torch.nn.functional` or one of the
following: 'mse', 'l1', 'cross_entropy',
'binary_cross_entropy_with_logits', 'binary_crossentropy',
'smooth_l1', 'kl_div'.

TYPE: Union[str, Callable] DEFAULT: 'mse'

optimizer_fn

Optimizer to be used for training the wrapped model. Can be an optimizer class provided by torch.optim or one of the following: "adam", "adam_w", "sgd", "rmsprop", "lbfgs".

TYPE: Union[str, Callable] DEFAULT: 'sgd'

lr

Learning rate of the optimizer.

TYPE: float DEFAULT: 0.001

output_is_logit

Whether the module produces logits as output. If true, either softmax or sigmoid is applied to the outputs when predicting.

is_feature_incremental

Whether the model should adapt to the appearance of previously features by adding units to the input layer of the network.

TYPE: bool DEFAULT: True

device

Device to run the wrapped model on. Can be "cpu" or "cuda".

TYPE: str DEFAULT: 'cpu'

seed

Random seed to be used for training the wrapped model.

TYPE: int DEFAULT: 42

**kwargs

Parameters to be passed to the build_fn function aside from n_features.

DEFAULT: {}