botiverse.bots.WhizBot package#
Submodules#
botiverse.bots.WhizBot.WhizBot module#
- class botiverse.bots.WhizBot.WhizBot.WhizBot(repr='BERT')[source]#
Bases:
objectA class that provides an interface for the WhizBot-BERT and WhizBot-GRU models.
Initializes WhizBot and sets its representation type. :param repr: The representation type of the WhizBot model. Either “BERT” or “GRU”. :type repr: str
- read_data(file_path)[source]#
Reads and pre-processes the data, sets up the model based on the data and prepares the train-validation split.
- Parameters:
file_path (str) – The path to the file that contains the dataset.
- Returns:
None
- train(epochs=10, batch_size=32)[source]#
Trains the model using the training dataset.
- Parameters:
epochs (int) – The number of training epochs.
batch_size (int) – The number of training examples utilized used to make one paramenters updat.
- Returns:
None
- validation(batch_size=32)[source]#
Tests the model performance using the validation dataset and calculates the accuracy.
- Parameters:
batch_size (int) – The number of training examples utilized used to make one paramenters updat.
- Returns:
None
- infer(string)[source]#
Performs inference using the model.
- Parameters:
string (str) – The input string to perform inference on.
- Returns:
A random response from the response list of the predicted label.
botiverse.bots.WhizBot.WhizBot_BERT module#
- class botiverse.bots.WhizBot.WhizBot_BERT.WhizBot_BERT[source]#
Bases:
objectAn interface for the WhizBot_BERT model which is a BERT model with a Feed Forward layes at the end.
Initializes WhizBot_BERT, and will prepare the GPU device based on CUDA availability.
- read_data(file_path)[source]#
Reads and pre-processes the data, sets up the model based on the data and prepares the train-validation split.
- Parameters:
file_path (str) – The path to the file that contains the dataset.
- Returns:
None
- train(epochs=10, batch_size=32)[source]#
Trains the model using the training dataset.
- Parameters:
epochs (int) – The number of training epochs.
batch_size (int) – The number of training examples utilized used to make one paramenters updat.
- Returns:
None
- validation(batch_size=32)[source]#
Tests the model performance using the validation dataset and calculates the accuracy.
- Parameters:
batch_size (int) – The number of training examples utilized used to make one paramenters updat.
- Returns:
None
- infer(string)[source]#
Performs inference using the model.
- Parameters:
string (str) – The input string to perform inference on.
- Returns:
A random response from the response list of the predicted label.
botiverse.bots.WhizBot.WhizBot_GRU module#
- class botiverse.bots.WhizBot.WhizBot_GRU.WhizBot_GRU[source]#
Bases:
objectAn interface for the WhizBot_GRU model which is based on simple GRU model
Initializes WhizBot_GRU, and will prepare the GPU device based on CUDA availability.
- read_data(file_path)[source]#
Reads and pre-processes the data, sets up the model based on the data and prepares the train-validation split.
- Parameters:
file_path (str) – The path to the file that contains the dataset.
- Returns:
None
- train(epochs=50, batch_size=32)[source]#
Trains the model using the training dataset.
- Parameters:
epochs (int) – The number of training epochs.
batch_size (int) – The number of training examples utilized used to make one paramenters updat.
- Returns:
None
- validation(batch_size=32)[source]#
Tests the model performance using the validation dataset and calculates the accuracy.
- Parameters:
batch_size (int) – The number of training examples utilized used to make one paramenters updat.
- Returns:
None
- infer(string)[source]#
Performs inference using the model.
- Parameters:
string (str) – The input string to perform inference on.
- Returns:
A random response from the response list of the predicted label.