class slugnet.model.Model(lr=0.1, n_epoch=400000, batch_size=32, layers=None, optimizer=<slugnet.optimizers.SGD object>, loss=<slugnet.loss.BinaryCrossEntropy object>, validation_split=0.2, metrics=['loss'], progress=True, log_interval=1)[source]

Bases: object

A model implement functionality for fitting a neural network and making predictions.

  • lr (float) – The learning rate to be used during training.
  • n_epoch (int) – The number of training epochs to use.
  • batch_size (int) – The size of each batch for training.
  • layers (list[slugnet.layers.Layer]) – Initial layers to add the the network, more can be added layer using the model.add_layer method.
  • optimizer (slugnet.optimizers.Optimizer) – The opimization method to use during training.
  • loss (slugnet.loss.Objective) – The loss function to use during training and validation.
  • validation_split (float) – The percent of data to use for validation, default is zero.
  • metrics (list[str]) – The metrics to print during training, options are loss and accuracy.
  • progress (bool) – Display progress-bar while training.
  • log_interval (int) – The epoch interval on which to print progress.
fit(X, y)[source]

Train the model given samples X and labels or values :code`y`.


Predict the labels or values of some input matrix X.