aepsych.plotting

aepsych.plotting module

aepsych.plotting.plot_strat(strat, ax=None, true_testfun=None, cred_level=0.95, target_level=0.75, xlabel=None, ylabel=None, yes_label='Yes trial', no_label='No trial', flipx=False, logx=False, gridsize=30, title='', save_path=None, show=True, include_legend=True, include_colorbar=True)[source]

Creates a plot of a strategy, showing participants responses on each trial, the estimated response function and threshold, and optionally a ground truth response threshold.

Parameters:
  • strat (Strategy) – Strategy object to be plotted. Must have a dimensionality of 2 or less.

  • ax (plt.Axes, optional) – Matplotlib axis to plot on (if None, creates a new axis). Default: None.

  • true_testfun (Callable, optional) – Ground truth response function. Should take a n_samples x n_parameters tensor as input and produce the response probability at each sample as output. Default: None.

  • cred_level (float) – Percentage of posterior mass around the mean to be shaded. Default: 0.95.

  • target_level (float, optional) – Response probability to estimate the threshold of. Default: 0.75.

  • xlabel (str, optional) – Label of the x-axis. Default: “Context (abstract)”.

  • ylabel (str, optional) – Label of the y-axis (if None, defaults to “Response Probability” for 1-d plots or “Intensity (Abstract)” for 2-d plots). Default: None.

  • yes_label (str) – Label of trials with response of 1. Default: “Yes trial”.

  • no_label (str) – Label of trials with response of 0. Default: “No trial”.

  • flipx (bool) –

    Whether the values of the x-axis should be flipped such that the min becomes the max and vice

    versa.

    (Only valid for 2-d plots.) Default: False.

  • logx (bool) – Whether the x-axis should be log-transformed. (Only valid for 2-d plots.) Default: False.

  • gridsize (int) – The number of points to sample each dimension at. Default: 30.

  • title (str) – Title of the plot. Default: ‘’.

  • save_path (str, optional) – File name to save the plot to. Default: None.

  • show (bool) – Whether the plot should be shown in an interactive window. Default: True.

  • include_legend (bool) – Whether to include the legend in the figure. Default: True.

  • include_colorbar (bool) – Whether to include the colorbar indicating the probability of “Yes” trials. Default: True.

Return type:

None

aepsych.plotting.plot_strat_3d(strat, parnames=None, outcome_label='Yes Trial', slice_dim=0, slice_vals=5, contour_levels=None, probability_space=False, gridsize=30, extent_multiplier=None, save_path=None, show=True)[source]

Creates a plot of a 2d slice of a 3D strategy, showing the estimated model or probability response and contours :param strat: Strategy object to be plotted. Must have a dimensionality of 3. :type strat: Strategy :param parnames: list of the parameter names. If None, defaults to [“x1”, “x2”, “x3”]. :type parnames: List[str], optional :param outcome_label: The label of the outcome variable :type outcome_label: str :param slice_dim: dimension to slice on. Default: 0. :type slice_dim: int :param slice_vals: values to take slices; OR number of values to take even slices from. Default: 5. :type slice_vals: Union[List[float], int] :param contour_levels: List contour values to plot. Default: None. If true, all integer levels. :type contour_levels: Union[Iterable[float], bool], optional :param probability_space: Whether to plot probability. Default: False :type probability_space: bool :param gridsize: The number of points to sample each dimension at. Default: 30. :type gridsize: int :param extent_multiplier: multipliers for each of the dimensions when plotting. If None, defaults to [1, 1, 1]. :type extent_multiplier: List[float], optional :param save_path: File name to save the plot to. Default: None. :type save_path: str, optional :param show: Whether the plot should be shown in an interactive window. Default: True. :type show: bool

Parameters:
  • strat (Strategy) –

  • parnames (Optional[List[str]]) –

  • outcome_label (str) –

  • slice_dim (int) –

  • slice_vals (Union[List[float], int]) –

  • contour_levels (Optional[Union[Iterable[float], bool]]) –

  • probability_space (bool) –

  • gridsize (int) –

  • extent_multiplier (Optional[List[float]]) –

  • save_path (Optional[str]) –

  • show (bool) –

Return type:

None

aepsych.plotting.plot_slice(ax, strat, parnames, slice_dim, slice_val, vmin, vmax, gridsize=30, contour_levels=None, lse=False, extent_multiplier=None)[source]

Creates a plot of a 2d slice of a 3D strategy, showing the estimated model or probability response and contours :param ax: Matplotlib axis to plot on :type ax: plt.Axes :param start: Strategy object to be plotted. Must have a dimensionality of 3. :type start: Strategy :param parnames: list of the parameter names. :type parnames: List[str] :param slice_dim: dimension to slice on. :type slice_dim: int :param slice_val: value to take the slice along that dimension. :type slice_val: int :param vmin: global model minimum to use for plotting. :type vmin: float :param vmax: global model maximum to use for plotting. :type vmax: float :param gridsize: The number of points to sample each dimension at. Default: 30. :type gridsize: int :param contour_levels: Contours to plot. Default: None :type contour_levels: Sized, optional :param lse: Whether to plot probability. Default: False :type lse: bool :param extent_multiplier: multipliers for each of the dimensions when plotting. Default:None :type extent_multiplier: List, optional

Returns:

The axis object with the plot.

Return type:

AxesImage

Parameters:
  • ax (Axes) –

  • strat (Strategy) –

  • parnames (List[str]) –

  • slice_dim (int) –

  • slice_val (int) –

  • vmin (float) –

  • vmax (float) –

  • gridsize (int) –

  • contour_levels (Optional[Sized]) –

  • lse (bool) –

  • extent_multiplier (Optional[List]) –