GPy.plotting.matplot_dep package¶
Subpackages¶
Submodules¶
GPy.plotting.matplot_dep.Tango module¶
GPy.plotting.matplot_dep.base_plots module¶
-
GPy.plotting.matplot_dep.base_plots.align_subplot_array(axes, xlim=None, ylim=None)[source]¶ Make all of the axes in the array hae the same limits, turn off unnecessary ticks use pb.subplots() to get an array of axes
-
GPy.plotting.matplot_dep.base_plots.align_subplots(N, M, xlim=None, ylim=None)[source]¶ make all of the subplots have the same limits, turn off unnecessary ticks
-
GPy.plotting.matplot_dep.base_plots.gpplot(x, mu, lower, upper, edgecol='#204a87', fillcol='#729fcf', ax=None, fignum=None, **kwargs)[source]¶
-
GPy.plotting.matplot_dep.base_plots.meanplot(x, mu, color='#204a87', ax=None, fignum=None, linewidth=2, **kw)[source]¶
GPy.plotting.matplot_dep.dim_reduction_plots module¶
-
GPy.plotting.matplot_dep.dim_reduction_plots.most_significant_input_dimensions(model, which_indices)[source]¶ Determine which dimensions should be plotted
-
GPy.plotting.matplot_dep.dim_reduction_plots.plot_latent(model, labels=None, which_indices=None, resolution=50, ax=None, marker='o', s=40, fignum=None, plot_inducing=False, legend=True, plot_limits=None, aspect='auto', updates=False, predict_kwargs={}, imshow_kwargs={})[source]¶ Parameters: - labels – a np.array of size model.num_data containing labels for the points (can be number, strings, etc)
- resolution – the resolution of the grid on which to evaluate the predictive variance
-
GPy.plotting.matplot_dep.dim_reduction_plots.plot_magnification(model, labels=None, which_indices=None, resolution=60, ax=None, marker='o', s=40, fignum=None, plot_inducing=False, legend=True, aspect='auto', updates=False)[source]¶ Parameters: - labels – a np.array of size model.num_data containing labels for the points (can be number, strings, etc)
- resolution – the resolution of the grid on which to evaluate the predictive variance
GPy.plotting.matplot_dep.img_plots module¶
The module contains the tools for ploting 2D image visualizations
GPy.plotting.matplot_dep.inference_plots module¶
GPy.plotting.matplot_dep.kernel_plots module¶
-
GPy.plotting.matplot_dep.kernel_plots.plot(kernel, x=None, fignum=None, ax=None, title=None, plot_limits=None, resolution=None, **mpl_kwargs)[source]¶ plot a kernel. :param x: the value to use for the other kernel argument (kernels are a function of two variables!) :param fignum: figure number of the plot :param ax: matplotlib axis to plot on :param title: the matplotlib title :param plot_limits: the range over which to plot the kernel :resolution: the resolution of the lines used in plotting :mpl_kwargs avalid keyword arguments to pass through to matplotlib (e.g. lw=7)
-
GPy.plotting.matplot_dep.kernel_plots.plot_ARD(kernel, fignum=None, ax=None, title='', legend=False, filtering=None)[source]¶ If an ARD kernel is present, plot a bar representation using matplotlib
Parameters: - fignum – figure number of the plot
- ax – matplotlib axis to plot on
- title – title of the plot, pass ‘’ to not print a title pass None for a generic title
- filtering (list of names to use for ARD plot) – list of names, which to use for plotting ARD parameters. Only kernels which match names in the list of names in filtering will be used for plotting.
GPy.plotting.matplot_dep.mapping_plots module¶
-
GPy.plotting.matplot_dep.mapping_plots.plot_mapping(self, plot_limits=None, which_data='all', which_parts='all', resolution=None, levels=20, samples=0, fignum=None, ax=None, fixed_inputs=[], linecol='#204a87')[source]¶ - Plots the mapping associated with the model.
- In one dimension, the function is plotted.
- In two dimsensions, a contour-plot shows the function
- In higher dimensions, we’ve not implemented this yet !TODO!
Can plot only part of the data and part of the posterior functions using which_data and which_functions
Parameters: - plot_limits (np.array) – The limits of the plot. If 1D [xmin,xmax], if 2D [[xmin,ymin],[xmax,ymax]]. Defaluts to data limits
- which_data (‘all’ or a slice object to slice self.X, self.Y) – which if the training data to plot (default all)
- which_parts (‘all’, or list of bools) – which of the kernel functions to plot (additively)
- resolution (int) – the number of intervals to sample the GP on. Defaults to 200 in 1D and 50 (a 50x50 grid) in 2D
- levels (int) – number of levels to plot in a contour plot.
- samples (int) – the number of a posteriori samples to plot
- fignum (figure number) – figure to plot on.
- ax (axes handle) – axes to plot on.
- fixed_inputs (a list of tuples) – a list of tuple [(i,v), (i,v)...], specifying that input index i should be set to value v.
- linecol – color of line to plot.
- levels – for 2D plotting, the number of contour levels to use is ax is None, create a new figure
GPy.plotting.matplot_dep.maps module¶
-
GPy.plotting.matplot_dep.maps.bbox_match(sf, bbox, inside_only=True)[source]¶ Return the geometry and attributes of a shapefile that lie within (or intersect) a bounding box
Parameters: - sf (shapefile object) – shapefile
- bbox (list of floats [x_min,y_min,x_max,y_max]) – bounding box
Inside_only: True if the objects returned are those that lie within the bbox and False if the objects returned are any that intersect the bbox
-
GPy.plotting.matplot_dep.maps.plot(shape_records, facecolor='w', edgecolor='k', linewidths=0.5, ax=None, xlims=None, ylims=None)[source]¶ Plot the geometry of a shapefile
Parameters: - shape_records (ShapeRecord object (output of a shapeRecords() method)) – geometry and attributes list
- facecolor – color to be used to fill in polygons
- edgecolor – color to be used for lines
- ax (axes handle) – axes to plot on.
-
GPy.plotting.matplot_dep.maps.plot_bbox(sf, bbox, inside_only=True)[source]¶ Plot the geometry of a shapefile within a bbox
Parameters: - sf (shapefile object) – shapefile
- bbox (list of floats [x_min,y_min,x_max,y_max]) – bounding box
Inside_only: True if the objects returned are those that lie within the bbox and False if the objects returned are any that intersect the bbox
GPy.plotting.matplot_dep.models_plots module¶
-
GPy.plotting.matplot_dep.models_plots.plot_fit(model, plot_limits=None, which_data_rows='all', which_data_ycols='all', fixed_inputs=[], levels=20, samples=0, fignum=None, ax=None, resolution=None, plot_raw=False, linecol='#204a87', fillcol='#729fcf', Y_metadata=None, data_symbol='kx')[source]¶ - Plot the posterior of the GP.
- In one dimension, the function is plotted with a shaded region identifying two standard deviations.
- In two dimsensions, a contour-plot shows the mean predicted function
- In higher dimensions, use fixed_inputs to plot the GP with some of the inputs fixed.
Can plot only part of the data and part of the posterior functions using which_data_rowsm which_data_ycols.
Parameters: - plot_limits (np.array) – The limits of the plot. If 1D [xmin,xmax], if 2D [[xmin,ymin],[xmax,ymax]]. Defaluts to data limits
- which_data_rows (‘all’ or a list of integers) – which of the training data to plot (default all)
- which_data_ycols – when the data has several columns (independant outputs), only plot these
- fixed_inputs (a list of tuples) – a list of tuple [(i,v), (i,v)...], specifying that input index i should be set to value v.
- resolution (int) – the number of intervals to sample the GP on. Defaults to 200 in 1D and 50 (a 50x50 grid) in 2D
- levels (int) – number of levels to plot in a contour plot.
- samples (int) – the number of a posteriori samples to plot
- fignum (figure number) – figure to plot on.
- ax (axes handle) – axes to plot on.
- linecol – color of line to plot.
- fillcol – color of fill
- levels – for 2D plotting, the number of contour levels to use is ax is None, create a new figure
GPy.plotting.matplot_dep.netpbmfile module¶
Read and write image data from respectively to Netpbm files.
This implementation follows the Netpbm format specifications at http://netpbm.sourceforge.net/doc/. No gamma correction is performed.
The following image formats are supported: PBM (bi-level), PGM (grayscale), PPM (color), PAM (arbitrary), XV thumbnail (RGB332, read-only).
| Author: | Christoph Gohlke |
|---|---|
| Organization: | Laboratory for Fluorescence Dynamics, University of California, Irvine |
| Version: | 2013.01.18 |
Requirements¶
- CPython 2.7, 3.2 or 3.3
- Numpy 1.7
- Matplotlib 1.2 (optional for plotting)
Examples¶
>>> im1 = numpy.array([[0, 1],[65534, 65535]], dtype=numpy.uint16)
>>> imsave('_tmp.pgm', im1)
>>> im2 = imread('_tmp.pgm')
>>> assert numpy.all(im1 == im2)
-
GPy.plotting.matplot_dep.netpbmfile.imread(filename, *args, **kwargs)[source]¶ Return image data from Netpbm file as numpy array.
args and kwargs are arguments to NetpbmFile.asarray().
>>> image = imread('_tmp.pgm')
-
GPy.plotting.matplot_dep.netpbmfile.imsave(filename, data, maxval=None, pam=False)[source]¶ Write image data to Netpbm file.
>>> image = numpy.array([[0, 1],[65534, 65535]], dtype=numpy.uint16) >>> imsave('_tmp.pgm', image)
GPy.plotting.matplot_dep.priors_plots module¶
GPy.plotting.matplot_dep.ssgplvm module¶
The module plotting results for SSGPLVM
GPy.plotting.matplot_dep.svig_plots module¶
GPy.plotting.matplot_dep.variational_plots module¶
-
GPy.plotting.matplot_dep.variational_plots.plot(parameterized, fignum=None, ax=None, colors=None)[source]¶ Plot latent space X in 1D:
- if fig is given, create input_dim subplots in fig and plot in these
- if ax is given plot input_dim 1D latent space plots of X into each axis
- if neither fig nor ax is given create a figure with fignum and plot in there
- colors:
- colors of different latent space dimensions input_dim
-
GPy.plotting.matplot_dep.variational_plots.plot_SpikeSlab(parameterized, fignum=None, ax=None, colors=None, side_by_side=True)[source]¶ Plot latent space X in 1D:
- if fig is given, create input_dim subplots in fig and plot in these
- if ax is given plot input_dim 1D latent space plots of X into each axis
- if neither fig nor ax is given create a figure with fignum and plot in there
- colors:
- colors of different latent space dimensions input_dim
GPy.plotting.matplot_dep.visualize module¶
-
GPy.plotting.matplot_dep.visualize.data_play(Y, visualizer, frame_rate=30)[source]¶ Play a data set using the data_show object given.
Y: the data set to be visualized. Parameters: visualizer (data_show) – the data show objectwhether to display during optimisation Example usage:
This example loads in the CMU mocap database (http://mocap.cs.cmu.edu) subject number 35 motion number 01. It then plays it using the mocap_show visualize object.
data = GPy.util.datasets.cmu_mocap(subject='35', train_motions=['01']) Y = data['Y'] Y[:, 0:3] = 0. # Make figure walk in place visualize = GPy.util.visualize.skeleton_show(Y[0, :], data['skel']) GPy.util.visualize.data_play(Y, visualize)
-
class
GPy.plotting.matplot_dep.visualize.data_show(vals)[source]¶ The data_show class is a base class which describes how to visualize a particular data set. For example, motion capture data can be plotted as a stick figure, or images are shown using imshow. This class enables latent to data visualizations for the GP-LVM.
-
class
GPy.plotting.matplot_dep.visualize.image_show(vals, axes=None, dimensions=(16, 16), transpose=False, order='C', invert=False, scale=False, palette=[], preset_mean=0.0, preset_std=1.0, select_image=0, cmap=None)[source]¶ Bases:
GPy.plotting.matplot_dep.visualize.matplotlib_showShow a data vector as an image. This visualizer rehapes the output vector and displays it as an image.
Parameters: - vals (axes handle) – the values of the output to display.
- axes – the axes to show the output on.
- dimensions (tuple) – the dimensions that the image needs to be transposed to for display.
- transpose – whether to transpose the image before display.
- order (string) – whether array is in Fortan ordering (‘F’) or Python ordering (‘C’). Default is python (‘C’).
- invert (bool) – whether to invert the pixels or not (default False).
- palette – a palette to use for the image.
- preset_mean (double) – the preset mean of a scaled image.
- preset_std (double) – the preset standard deviation of a scaled image.
- cmap (matplotlib.cm) – the colormap for image visualization
-
class
GPy.plotting.matplot_dep.visualize.lvm(vals, model, data_visualize, latent_axes=None, sense_axes=None, latent_index=[0, 1], disable_drag=False)[source]¶
-
class
GPy.plotting.matplot_dep.visualize.lvm_dimselect(vals, model, data_visualize, latent_axes=None, sense_axes=None, latent_index=[0, 1], labels=None)[source]¶ Bases:
GPy.plotting.matplot_dep.visualize.lvmA visualizer for latent variable models which allows selection of the latent dimensions to use by clicking on a bar chart of their length scales.
For an example of the visualizer’s use try:
GPy.examples.dimensionality_reduction.BGPVLM_oil()
-
class
GPy.plotting.matplot_dep.visualize.lvm_subplots(vals, Model, data_visualize, latent_axes=None, sense_axes=None)[source]¶ Bases:
GPy.plotting.matplot_dep.visualize.lvmlatent_axes is a np array of dimension np.ceil(input_dim/2), one for each pair of the latent dimensions.
-
class
GPy.plotting.matplot_dep.visualize.matplotlib_show(vals, axes=None)[source]¶ Bases:
GPy.plotting.matplot_dep.visualize.data_showthe matplotlib_show class is a base class for all visualization methods that use matplotlib. It is initialized with an axis. If the axis is set to None it creates a figure window.
-
class
GPy.plotting.matplot_dep.visualize.mocap_data_show(vals, axes=None, connect=None)[source]¶ Bases:
GPy.plotting.matplot_dep.visualize.matplotlib_showBase class for visualizing motion capture data.
-
class
GPy.plotting.matplot_dep.visualize.mocap_data_show_vpython(vals, scene=None, connect=None, radius=0.1)[source]¶ Bases:
GPy.plotting.matplot_dep.visualize.vpython_showBase class for visualizing motion capture data using visual module.
-
class
GPy.plotting.matplot_dep.visualize.skeleton_show(vals, skel, axes=None, padding=0)[source]¶ Bases:
GPy.plotting.matplot_dep.visualize.mocap_data_showdata_show class for visualizing motion capture data encoded as a skeleton with angles.
-
class
GPy.plotting.matplot_dep.visualize.stick_show(vals, connect=None, axes=None)[source]¶ Bases:
GPy.plotting.matplot_dep.visualize.mocap_data_showShow a three dimensional point cloud as a figure. Connect elements of the figure together using the matrix connect.
-
class
GPy.plotting.matplot_dep.visualize.vector_show(vals, axes=None)[source]¶ Bases:
GPy.plotting.matplot_dep.visualize.matplotlib_showA base visualization class that just shows a data vector as a plot of vector elements alongside their indices.
-
class
GPy.plotting.matplot_dep.visualize.vpython_show(vals, scene=None)[source]¶ Bases:
GPy.plotting.matplot_dep.visualize.data_showthe vpython_show class is a base class for all visualization methods that use vpython to display. It is initialized with a scene. If the scene is set to None it creates a scene window.