bebi103.viz.corner

bebi103.viz.corner(samples=None, parameters=None, palette=None, omit=None, include_ppc=False, include_log_lik=False, max_plotted=10000, datashade=False, frame_width=None, frame_height=None, plot_ecdf=False, ecdf_staircase=False, cmap='black', color_by_chain=False, divergence_color='orange', alpha=None, single_var_color='black', bins='freedman-diaconis', show_contours=False, contour_color='black', bins_2d=50, levels=None, weights=None, smooth=0.02, extend_contour_domain=False, xtick_label_orientation='horizontal', min_border_left=80, min_border_bottom=None)

Make a corner plot of sampling results. Heavily influenced by the corner package by Dan Foreman-Mackey.

Parameters
  • samples (Numpy array, Pandas DataFrame, or ArviZ InferenceData) – Results of sampling. If a Numpy array or Pandas DataFrame, each row is a sample and each column corresponds to a variable.

  • parameters (list) – List of variables as strings included in samples to construct corner plot. If None, use all parameters. The entries correspond to column headings if samples is in a Pandas DataFrame. If the input is a Numpy array, parameters is a list of indices of columns to use in the plot. If samples is an ArviZ InferenceData instance, parameters contains the names of parameters to include in the plot. For multidimensional parameters, each entry must be given separately, e.g., [‘alpha[0]’, ‘alpha[1]’, ‘beta[0,1]’]. If a given entry is a 2-tuple, the first entry is the variable name, and the second entry is the label for the parameter in plots. If an entry is a 2-tuple, the first entry is the parameter name and the second entry is a string to be used for the parameter as axis labels.

  • palette (list of strings of hex colors, or single hex string) – If a list, color palette to use. If a single string representing a hex color, all glyphs are colored with that color. Default is the default color cycle employed by Altair. Ignored is color_by_chain is False.

  • omit (str, re.Pattern, or list or tuple of str and re.Pattern) – If parameters is not provided, all parameters are used in the parallel coordinate plot. We often want to ignore samples of some variables. For each string entry in omit, the variable given by the string is omitted. For each entry that is a compiled regular expression patters (re.Pattern), any variable name matching the pattern is omitted.

  • include_ppc (bool, default False) – If True, include variables ending in _ppc, which denotes posterior predictive checks, in the plot.

  • include_log_lik (bool, default False) – If True, include variables starting with log_lik or loglik. These denote log-likelihood contributions.

  • max_plotted (int, default 10000) – Maximum number of points to be plotted.

  • datashade (bool, default False) – Whether or not to convert sampled points to a raster image using Datashader.

  • frame_width (int or None, default None) – Width of each plot in the corner plot in pixels. Default is set based on number of parameters plotted. If None and frame_height is specificed, frame_width is set to frame_height.

  • frame_height (int or None, default None) – Height of each plot in the corner plot in pixels. Default is set based on number of parameters plotted. If None and frame_width is specificed, frame_height is set to frame_width.

  • plot_ecdf (bool, default False) – If True, plot ECDFs of samples on the diagonal of the corner plot. If False, histograms are plotted.

  • ecdf_staircase (bool, default False) – If True, plot the ECDF in “staircase” style. Otherwise, plot as dots. Ignored if plot_ecdf is False.

  • cmap (str, default 'black') – Valid colormap string for DataShader or for coloring Bokeh glyphs.

  • color_by_chain (bool, default False) – If True, color the glyphs by chain index.

  • divergence_color (str, default 'orange') – Color to use for showing points where the sampler experienced a divergence.

  • alpha (float or None, default None) – Opacity of glyphs. If None, inferred.

  • single_var_color (str, default 'black') – Color of histogram or ECDF lines.

  • bins (int, array_like, or str, default 'freedman-diaconis') – If int or array_like, setting for bins kwarg to be passed to np.histogram(). If ‘exact’, then each unique value in the data gets its own bin. If ‘integer’, then integer data is assumed and each integer gets its own bin. If ‘sqrt’, uses the square root rule to determine number of bins. If freedman-diaconis, uses the Freedman-Diaconis rule for number of bins. Ignored if plot_ecdf is True.

  • show_contours (bool, default False) – If True, show contour plot on top of samples.

  • contour_color (str, default 'black') – Color of contour lines

  • bins_2d (int, default 50) – Number of bins in each direction for binning 2D histograms when computing contours.

  • levels (list of floats, default None) – Levels to use when constructing contours. By default, these are chosen according to this principle from Dan Foreman-Mackey: http://corner.readthedocs.io/en/latest/pages/sigmas.html

  • weights (default None) – Value to pass as weights kwarg to np.histogram2d(), used in constructing contours.

  • smooth (int or None, default 1) – Width of smoothing kernel for making contours.

  • extend_contour_domain (bool, default False) – If True, extend the domain of the contours a little bit beyond the extend of the samples. This is done in the corner package, but I prefer not to do it.

  • xtick_label_orientation (str or float, default 'horizontal'.) – Orientation of x tick labels. In some plots, horizontally labeled ticks will have label clashes, and this can fix that. A preferred alternative to ‘horizontal’ is np.pi/4. Be aware, though, that non-horizontal tick labels may disrupt alignment of some of the plots in the corner plot.

  • min_border_left (int or None, default None) – Argument passed to bokeh.plotting.figure() in making the plots on the left side of the corner plot. A larger value moves the corner plot further right from the toolbar. Too small of a value results in misalignment of plots if the values of the y-axis are such that the numbers take up a lot of space. If you make a corner plot and find that this misalignment is the case, you should increase min_border_left.

  • min_border_left – Argument passed to bokeh.plotting.figure() in making the plots on the bottom of the corner plot. A larger value moves the corner plot further up. Too small of a value results in misalignment of plots if the xtick_label_orientation is not ‘horizontal’ and the numbers take up a lot of space. If you make a corner plot and find that this misalignment is the case, you should increase min_border_bottom. By default if xtick_label_orientation is ‘horizontal’, the min_border_bottom is set to zero. Otherwise, unless specified by this keyword argument, it is set to 80.

Returns

output – Corner plot as a Bokeh layout.

Return type

Bokeh layout