Module misc.visualize includes useful functions for visualizing datasets or image filters.
This module contains the following functions:
Plots in 2D a set of points (the rows of NumPy 2D array inputs), using t-SNE.
A color coding can be specified with option colors (e.g. [‘b’,’r’,’k’,’k’] would yield one blue, one red and two black points). String labels for each data point can also be provided. initial_dims and perplexity are hyper-parameters of t-SNE.
This function requires t-SNE python code prodived by Laurens van der Maaten (see README in mlpython/misc/third_party/tsne/).
Plots the rows of NumPy 2D array weights as d1 by d2 images.
The images are layed out in a nrows by ncols grid.
Option scale sets the maximum absolute value of elements in weights that will be plotted (larger values will be clamped to scale, with the right sign).
Plots samples in a NumPy 2D array samples as d1 by d2 images. (one sample per row of samples).
The samples are assumed to be images with binary pixels. The images are layed out in a nrows by ncols grid.
Plots filters in a NumPy 2D array filters as d1 by d2 images. (one sample per row of filters).
The filters are assumed to be color images. The first d1*d2 elements of each row are the R channel values of each pixel, then follows the G and B channels. The images are layed out in a nrows by ncols grid.
The main difference with show_color_images is that each filter’s intensity is normalized, individually.
Plots samples in a NumPy 2D array samples as d1 by d2 images. (one sample per row of samples).
The samples are assumed to be color images. The first d1*d2 elements of each row are the R channel values of each pixel, then follows the G and B channels. The images are layed out in a nrows by ncols grid.
Thanks to Ilya Sutskever for sharing his code, from which this code is inspired.