sconce.trainers package

sconce.trainers.autoencoder_trainer module

class sconce.trainers.autoencoder_trainer.AutoencoderMixin[source]

Bases: abc.ABC

plot_input_output_pairs(title='A Sampling of Autoencoder Results', num_cols=10, figsize=(15, 3.2))[source]
plot_latent_space(title='Latent Representation', figsize=(8, 8))[source]
class sconce.trainers.autoencoder_trainer.AutoencoderTrainer(*, model, validation_feed=None, training_feed=None, monitor=None)[source]

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.SingleClassImageClassifierMixin[source]

Bases: abc.ABC

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

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.
  • 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, monitor=None)[source]

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)