API Reference: Training

masterful.training.TrainingReport

class masterful.training.TrainingReport(validation_results=None, gpu_info=None, history=None, model=None)

Structure which holds the results of a training run.

Parameters
  • validation_results (Dict[str, float]) – The final results from evaluating the model on the validation set.

  • gpu_info (Sequence[masterful.utils.gpu.GpuInfo]) – A list of GpuInfo objects, with relevant gpu usage information.

  • history (keras.callbacks.History) – The full training history report, containing the results at the end of each epoch for key metrics.

  • model (Optional[keras.engine.training.Model]) – A reference to the trained model. This will be different than the model passed in for training if model_ensemble is greater than 1.

Return type

None

masterful.training.train

masterful.training.train(model, model_params, optimization_params, regularization_params, ssl_params, training_dataset, training_dataset_params, validation_dataset=None, validation_dataset_params=None, unlabeled_datasets=None, synthetic_datasets=None, **kwargs)

Trains a model using the Masterful platform.

The model passed into this function will be trained against the passed in datasets using the given parameters for regularization, optimization, and semi-supervised learning.

Example:

model: tf.keras.Model = ...
model_params: masterful.architecture.params.ArchitectureParams = ...
optimization_params: masterful.optimization.params.OptimizationParams = ...
regularization_params: masterful.regularization.RegularizationParams = ...
ssl_params: masterful.ssl.params.SemiSupervisedParams = ...
training_dataset: tf.data.Dataset = ...
training_dataset_params: masterful.data.params.DataParams = ...
training_report = masterful.training.train(
    model=model,
    model_params=model_params,
    optimization_params=optimization_params,
    regularization_params=regularization_params,
    ssl_params=ssl_params,
    training_dataset=training_dataset,
    training_dataset_params=training_dataset_params)
Parameters
Returns

An instance of TrainingReport with the full results of training the model with the given parameters.

Return type

masterful.training.TrainingReport