sconce.trainers package — Pytorch-Sconce master documentation

# sconce.trainers package

## sconce.trainers.autoencoder_trainer module

class `sconce.trainers.autoencoder_trainer.` `AutoencoderMixin`

  Bases: `abc.ABC`

  `plot_input_output_pairs`(title='A Sampling of Autoencoder Results', num_cols=10, figsize=(15, 3.2))
  `plot_latent_space`(title='Latent Representation', figsize=(8, 8))

class `sconce.trainers.autoencoder_trainer.` `AutoencoderTrainer`(*, model, validation_feed=None, training_feed=None, test_data_generator=None, training_data_generator=None, monitor=None)

  Bases: `sconce.trainer.Trainer`, `sconce.trainers.autoencoder_trainer.AutoencoderMixin`

## sconce.trainers.single_class_image_classifier_trainer module

class `sconce.trainers.single_class_image_classifier_trainer.` `ClassifierTrainer`(*args, **kwargs)

  Bases: `sconce.trainer.Trainer`, `sconce.trainers.single_class_image_classifier_trainer.SingleClassImageClassifierMixin`

  Warning

  This class has been deprecated for `SingleClassImageClassifierTrainer` and will be removed soon. It will continue to work for now, but please update your code accordingly.

class `sconce.trainers.single_class_image_classifier_trainer.` `SingleClassImageClassifierMixin`

  Bases: `abc.ABC`

  `get_classification_accuracy`(data_generator=None, feed=None, cache_results=True)
  `get_confusion_matrix`(data_generator=None, feed=None, cache_results=True)
  `plot_confusion_matrix`(data_generator=None, feed=None, **heatmap_kwargs)
  `plot_samples`(predicted_class, true_class=None, data_generator=None, feed=None, sort_by='rising predicted class score', num_samples=7, num_cols=7, figure_width=15, image_height=3, cache_results=True)

    Plot samples of the dataset where the given <predicted_class> was predicted by the model.

    Parameters: | predicted_class (int or string) – the class string or the index of the class that was predicted by the model. true_class (int or string) – the class string or the index of the class that the image actually belongs to. data_generator (`SingleClassImageDataGenerator`) – DEPRECATED, use feed argument instead. feed (`DataFeed`) – the DataFeed to use to find the samples. sort_by (string) – one of the sort_by strings, see note below. num_samples (int) – the number of sample images to plot. num_cols (int) – the number of columns to plot, one image per column. figure_width (float) – the size, in matplotlib-inches, for the width of the whole figure. image_height (float) – the size, in matplotlib-inches, for the height of a single image. cache_results (bool) – keep the results in memory to make subsequent plots faster. Beware, that on large datasets (like imagenet) this can cause your system to run out of memory.

    Note

    The sort_by strings supported are:
      - “rising predicted class score”: samples are plotted in order of the lowest predicted class score to the highest predicted class score.
      - “falling predicted class score”: samples are plotted in order of the higest predicted class score to the lowest predicted class score.
      - “rising true class score”: samples are plotted in order of the lowest true class score to the highest true class score.
      - “falling true class score”: samples are plotted in order of the higest true class score to the lowest true class score.

class `sconce.trainers.single_class_image_classifier_trainer.` `SingleClassImageClassifierTrainer`(*, model, validation_feed=None, training_feed=None, test_data_generator=None, training_data_generator=None, monitor=None)

  Bases: `sconce.trainer.Trainer`, `sconce.trainers.single_class_image_classifier_trainer.SingleClassImageClassifierMixin`

  A trainer with some methods that are handy when you’re training an image classifier model. Specifically a model that classifies images into a single class per image.

  New in 0.10.0 (Used to be called ClassifierTrainer)