phitodeep.model
Classes
Fluent API for building Sequential models. |
Module Contents
- class phitodeep.model.Sequential(*layers, alpha=0.01, optimizer: phitodeep.optimization.optimizers.Optimizer = o.Adam(), batch_size=None, epochs=1000, loss_class=ls.MeanSquaredError())[source]
- layers = []
- alpha = 0.01
- optimizer_type
- batch_size = None
- epochs = 1000
- loss_class
- train(X, y, X_test, y_test)[source]
Train the model using the specified optimizer and loss function.
- Parameters:
X (np.ndarray) – Training data.
y (np.ndarray) – Training labels.
X_test (np.ndarray) – Test data.
y_test (np.ndarray) – Test labels.
- Returns:
A list of tuples containing the training and test losses for each epoch.
- Return type:
list
- predict(X)[source]
Forward pass through all layers.
- Parameters:
X – input array
- Returns:
output after passing through all layers
- backward(gradient)[source]
Backward pass through all layers.
- Parameters:
gradient – dL/dY from loss function (shape: batch_size x output_size)
Propagates gradient backwards through all layers in reverse order. Each layer computes its parameter gradients, updates parameters, and returns the gradient for the previous layer.