botiverse.models.GRUClassifier package#
Submodules#
botiverse.models.GRUClassifier.GRUClassifier module#
- class botiverse.models.GRUClassifier.GRUClassifier.BasicGRU(input_size, dropout_p=0.1)[source]#
Bases:
ModuleAn interface for the basic GRU unit
Constructs a BasicGRU instance with specific layer sizes and dropout probability.
- Parameters:
input_size (int) – The size of the input to the model.
dropout_p (float) – A regularization parameter.
- Returns:
None
- forward(input, hidden)[source]#
Defines the computation performed by the model.
- Parameters:
input (Tensor) – The provided sequance input.
hidden (Tensor) – The provided hidden state.
- Returns:
New hidden state.
- Return type:
Tensor
- initHidden(batch_size)[source]#
Creates a tensor of zeros for the hidden state initialization.
- Parameters:
batch_size (int) – The size of the batch for which the hidden state is to be initialized.
- Returns:
Tensor of zeros of the shape (batch_size, 1, hidden_size).
- Return type:
Tensor
- training: bool#
- class botiverse.models.GRUClassifier.GRUClassifier.GRUTextClassifier(vocabulary, embedding_size, output_size, dropout_p=0.1)[source]#
Bases:
ModuleAn interface for the GRU text classifier which uses a basic GRU unit with a linear output layer and an input embedding layer
Constructs a GRUTextClassifier instance with specific hyperparameters.
- Parameters:
vocabulary (int) – The size of vocabulary used in the Embedding layer.
embedding_size (int) – The size of each embedding vector.
output_size (int) – The size of the output from the model (number of classes).
dropout_p (float) – A regularization parameter.
- Returns:
None
- forward(input)[source]#
Defines the computation performed by the model.
- Parameters:
input (Tensor) – The model input.
- Returns:
Output after the forward pass (classes probabilities).
- Return type:
Tensor
- training: bool#