class documentation
class BaseModel: (source)
Known subclasses: shamboflow.models.Sequential
Constructor: BaseModel(**kwargs)
The Base class for models
All other models need to inherit from this class. It provides a template with all the methods a model will need to execute.
- Attributes
- layers:
- A list of layers present in the model in the order from input to output
- weights:
- A list of all weight matrices for the layers in the model
- loss:
- The loss/cost function to use calculate error of the model at a given state
- train_data_x:
- The training data or features
- train_data_y:
- Training features' corresponding labels
And more attributes
Method | __init__ |
Initialize the required attributes. |
Method | add |
Method to add layers to the model |
Method | compile |
Model compilation method |
Method | evaluate |
Evaluates metrics based on a Test dataset |
Method | fit |
Method to train the model on data |
Method | predict |
Calculate inference using the trained model |
Method | save |
Saves the model to the disk |
Method | stop |
Method to stop the training |
Method | summary |
Prints a summary of the model with all necessary details |
Instance Variable | accuracy |
The accuracy value of the model at any instance |
Instance Variable | callbacks |
A list of callback functions |
Instance Variable | current |
The current epoch of the model during training |
Instance Variable | epochs |
Number of epochs to train for |
Instance Variable | error |
The loss value of the model at any instance |
Instance Variable | has |
Boolean flag fo if the the model has validation data |
Instance Variable | is |
Has the model been compiled |
Instance Variable | is |
Is the model training right now |
Instance Variable | layers |
A list of layers in the model |
Instance Variable | learning |
The learning rate of the model |
Instance Variable | loss |
The loss function used by the model |
Instance Variable | loss |
The name of the loss function used |
Instance Variable | metrics |
A dictionary of metrics for the model. Includes loss, acc, val_loss, val_acc |
Instance Variable | parameters |
Amount of trainable parameters in the model |
Instance Variable | test |
Features of the test dataset |
Instance Variable | test |
Labels for the test dataset |
Instance Variable | train |
The feature list of the dataset |
Instance Variable | train |
The labels for each data in the dataset |
Instance Variable | validation |
Features of validation set |
Instance Variable | validation |
Labels of the validation set |
Instance Variable | weights |
A list of all weights between each layers |
overridden in
shamboflow.models.Sequential
Initialize the required attributes.
Also optionally takes in a list of layers as a parameter.
- Keyword Args
- layers: It takes a list of layers and them to the model
overridden in
shamboflow.models.Sequential
Method to add layers to the model
- Args
- layer:
- layer to add to the model
overridden in
shamboflow.models.Sequential
Method to train the model on data
To be implemented in child