gobbli.experiment package

Module contents

class gobbli.experiment.ClassificationExperiment(*args, **kwargs)[source]

Bases: gobbli.experiment.base.BaseExperiment

Run a classification experiment. This entails training a model to make predictions given some input.

The experiment will, for each combination of model hyperparameters, train the model on a training set and evaluate it on a validation set. The best combination of hyperparameters will be retrained on the combined training/validation sets and evaluated on the test set. After completion, the experiment will return ClassificationExperimentResults, which will allow the user to examine the results in various ways.

data_dir()
Return type

Path

Returns

The main data directory unique to this experiment.

property metadata_path
Return type

Path

Returns

The path to the experiment’s metadata file containing information about the experiment parameters.

run(dataset_split=None, seed=1, train_batch_size=32, valid_batch_size=32, test_batch_size=32, num_train_epochs=5)[source]

Run the experiment.

Parameters
  • dataset_split (Union[Tuple[float, float], Tuple[float, float, float], None]) – A tuple describing the proportion of the dataset to be added to the train/validation/test splits. If the experiment uses an explicit test set (passes BaseExperiment.params.test_dataset), this should be a 2-tuple describing the train/validation split. Otherwise, it should be a 3-tuple describing the train/validation/test split. The tuple must sum to 1.

  • seed (int) – Random seed to be used for dataset splitting for reproducibility.

  • train_batch_size (int) – Number of observations per batch on the training dataset.

  • valid_batch_size (int) – Number of observations per batch on the validation dataset.

  • test_batch_size (int) – Number of observations per batch on the test dataset.

  • num_train_epochs (int) – Number of epochs to use for training.

Return type

ClassificationExperimentResults

Returns

The results of the experiment.