Models#
- class helixnet.models.Sequential(layers_: list[Layer])#
A Simple model that propagate through the layers in a linear way
- Parameters:
layer (list) – the list which contains the layers
- add(layer: Layer) None#
This function can append layers to the model
- Parameters:
layer (layer.Layer) – The layer that will be appended to the end of the model
- fit(X, Y, loss_func: Callable, optimizer, epochs: int = 1, batch_size: int | None = None, preprocessing: Callable | None = None, metrics: Dict[str, Callable] | None = None)#
A high-level training loop with a rich, interactive display.
- forward(x: Tensor) Tensor#
Perform a prediction across multiple layers
- Args:
x (mg.tensor): the input
- Returns:
mg.tensor: the predictions
- get_names() List[str]#
Returns a list of layers names
- Returns:
list: A list of strings
- get_weights() List[ndarray]#
Returns a flat list of all trainable weights in the model.
- null_grads() None#
Reset the gradients of every layer
- output_shape() Tuple[int]#
A simple function that shows the model’s last layer’s output shape
- predict(x: Tensor) Tensor#
This method let the model predict without building computational graph
- Parameters:
x (mg.Tensor) – The models input
- Return mg.Tensor:
The models predictions
- set_weights(weights: List[ndarray])#
Sets the model’s weights from a flat list.
- Parameters:
weights (List[np.ndarray]) – The weights what will be produced by
helixnet.io.load_model()
- summary() None#
This method prints the model summary which contains the name of every layer and it’s shape