rofunc.utils.visualab.distribution#

1.  Module Contents#

1.1.  Functions#

gmm_plot2d

This function displays the parameters of a Gaussian Mixture Model (GMM).

gmm_plot3d

Visualize the 3D GMM as ellipsoids.

gmm_plot

This function displays the parameters of a Gaussian Mixture Model (GMM), either in 2D or 3D.

1.2.  API#

rofunc.utils.visualab.distribution.gmm_plot2d(Mu, Sigma, nbStates, color=[1, 0, 0], alpha=0.5, linewidth=1, markersize=6, ax=None, empty=False, edgecolor=None, edgealpha=None, priors=None, border=False, nb=1, swap=True, center=True, zorder=20)[source]#

This function displays the parameters of a Gaussian Mixture Model (GMM).

Inputs —————————————————————–

o Mu: D x K array representing the centers of K Gaussians. o Sigma: D x D x K array representing the covariance matrices of K Gaussians.

Author: Martijn Zeestraten, 2015

http://programming-by-demonstration.org/martijnzeestraten

Note- Daniel Berio, switched matrix layout to be consistent with pbdlib matlab,

probably breaks with gmm now.

rofunc.utils.visualab.distribution.gmm_plot3d(mu, covariance, color, alpha=0.5, ax=None, scale=0.1, max_gaussian=10)[source]#

Visualize the 3D GMM as ellipsoids.

Example:

>>> from rofunc.utils.visualab.distribution import gmm_plot3d
>>> import numpy as np
>>> mu = np.array([[0.5, 0.0, 0.0],
...                [0.0, 0.0, 0.0],
...                [-0.5, -0.5, -0.5],
...                [-0.8, 0.3, 0.4]])
>>> covs = np.array([np.diag([0.01, 0.01, 0.03]),
...                  np.diag([0.08, 0.01, 0.01]),
...                  np.diag([0.01, 0.05, 0.01]),
...                  np.diag([0.03, 0.07, 0.01])])
>>> gmm_plot3d(mu, covs, [0, 0, 0, 0])
Parameters:
  • mu – the mean point coordinate of the GMM

  • covariance – the covariance matrix of the GMM

  • color – the color of the ellipsoid

  • alpha – the transparency of the ellipsoid

  • ax – the axis to plot the GMM

  • scale – the scale of the ellipsoid

  • max_gaussian – the maximum number of Gaussian to plot

Returns:

rofunc.utils.visualab.distribution.gmm_plot(Mu, Sigma, dim=None, color=[1, 0, 0], alpha=0.5, linewidth=1, markersize=6, ax=None, empty=False, edgecolor=None, edgealpha=None, priors=None, border=False, nb=1, swap=True, center=True, zorder=20, scale=0.2)[source]#

This function displays the parameters of a Gaussian Mixture Model (GMM), either in 2D or 3D.

Parameters:
  • Mu – the mean point coordinate of the GMM

  • Sigma – the covariance matrix of the GMM

  • dim – the dimension of the GMM

  • color – the color of the ellipsoid

  • alpha – the transparency of the ellipsoid

  • linewidth – the width of the ellipsoid

  • markersize – the size of the marker

  • ax – the axis to plot the GMM

  • empty – whether to empty the axis

  • edgecolor – the color of the edge

  • edgealpha – the transparency of the edge

  • priors – the prior of the GMM

  • border – the border of the GMM

  • nb

  • swap

  • center

  • zorder – the plotting order

  • scale – the scale of the ellipsoid

Returns: