util.visualization package¶
Submodules¶
util.visualization.confusion_matrix_heatmap module¶
-
util.visualization.confusion_matrix_heatmap.
make_heatmap
(confusion_matrix, class_names)[source]¶ This function prints and plots the confusion matrix.
Adapted from https://gist.github.com/shaypal5/94c53d765083101efc0240d776a23823
- Parameters
confusion_matrix (numpy.ndarray) – Array containing the confusion matrix to be plotted
class_names (list of strings) – Names of the different classes
- Returns
data – Contains an RGB image of the plotted confusion matrix
- Return type
numpy.ndarray
util.visualization.decision_boundaries module¶
-
util.visualization.decision_boundaries.
plot_decision_boundaries
(output_winners, output_confidence, grid_x, grid_y, point_x, point_y, point_class, num_classes, step, writer, epochs, **kwargs)[source]¶ Plots the decision boundaries as a 2D image onto Tensorboard.
- Parameters
output_winners (numpy.ndarray) – which class is the ‘winner’ of the network at each location
output_confidence (numpy.ndarray) – confidence value of the network for the ‘winner’ class
grid_x (numpy.ndarray) – X axis locations of the decision grid
grid_y (numpy.ndarray) – Y axis locations of the decision grid
point_x (numpy.ndarray) – X axis locations of the real points to be plotted
point_y (numpy.ndarray) – Y axis locations of the real points to be plotted
point_class (numpy.ndarray) – class of the real points at each location
writer (tensorboardX SummaryWriter) – Tensorboard summarywriter object
num_classes (int) – number of unique classes
step (int) – global training step
epochs (int) – total number of training epochs
- Returns
- Return type
util.visualization.embedding module¶
This script generates embedding visualization for features produced by the apply_model script.
-
util.visualization.embedding.
isomap
(features, n_components=2)[source]¶ Returns the embedded points for Isomap. :Parameters: * features (numpy.ndarray) – contains the input feature vectors.
n_components (int) – number of components to transform the features into
- Returns
embedding – x,y(z) points that the feature vectors have been transformed into
- Return type
numpy.ndarray
-
util.visualization.embedding.
mds
(features, n_components=2)[source]¶ Returns the embedded points for MDS. :Parameters: * features (numpy.ndarray) – contains the input feature vectors.
n_components (int) – number of components to transform the features into
- Returns
embedding – x,y(z) points that the feature vectors have been transformed into
- Return type
numpy.ndarray
-
util.visualization.embedding.
pca
(features, n_components=2)[source]¶ Returns the embedded points for PCA. :Parameters: * features (numpy.ndarray) – contains the input feature vectors.
n_components (int) – number of components to transform the features into
- Returns
embedding – x,y(z) points that the feature vectors have been transformed into
- Return type
numpy.ndarray
-
util.visualization.embedding.
tsne
(features, n_components=2)[source]¶ Returns the embedded points for TSNE. :Parameters: * features (numpy.ndarray) – contains the input feature vectors.
n_components (int) – number of components to transform the features into
- Returns
embedding – x,y(z) points that the feature vectors have been transformed into
- Return type
numpy.ndarray
util.visualization.mean_std_plot module¶
-
util.visualization.mean_std_plot.
plot_mean_std
(x=None, arr=None, suptitle='', title='', xlabel='X', ylabel='Y', xlim=None, ylim=None)[source]¶ Plots the accuracy/loss curve over several runs with standard deviation and mean. :Parameters: * x (numpy.ndarray) – contains the ticks on the x-axis
arr (numpy.ndarray) – contains the accuracy values for each epoch per run
suptitle (str) – title for the plot
title (str) – sub-title for the plot
xlabel (str) – label for the x-axis
ylabel (str) – label for the y-axis
xlim (float or None) – optionally specify a upper limit on the x-axis
ylim (float or None) – optionally specify a upper limit on the y-axis
- Returns
data – Contains an RGB image of the plotted accuracy curves
- Return type
numpy.ndarray
util.visualization.visualize_activations module¶
This script generates visualizations of the activation of intermediate layers of CNNs.
-
util.visualization.visualize_activations.
main
(args)[source]¶ Main routine of script to generate activation heatmaps. :Parameters: args (argparse.Namespace) – contains all arguments parsed from input
- Returns
- Return type
-
util.visualization.visualize_activations.
make_grid_own
(activations)[source]¶ Plots all activations of a layer in a grid format. :Parameters: activations (numpy.ndarray) – array of activation values for each filter in a layer
- Returns
large_fig – image array containing all activation heatmaps of a layer
- Return type
numpy.ndarray