gpmp.plot module¶
The gpmp.plot module contains Matplotlib-based helpers for common GP
figures. It accepts backend-native gpmp.num objects and converts them
to NumPy internally before plotting. The functions are intentionally
lightweight and return a GPmp Figure wrapper when applicable.
Main functions¶
Figurewraps a Matplotlib figure and axes and exposes convenience methods such asplotgpfor posterior means and coverage intervals.crosssections(model, xi, zi, box, ...)plots one-dimensional predictive sweep studies through selected anchor observations. It can automatically use the observation with minimum or maximum response viaind_i="min"orind_i="max"and can show projected observation points.plot_loo(zi, zloom, zloov)plots leave-one-out predictions with 95% intervals against observed values.
GPmp plotting utilities.
- class gpmp.plot.Figure(nrows=1, ncols=1, isinteractive=True, boxoff=True, **kargs)[source]¶
Figures manager class.
- plotgp(x, mean, variance, colorscheme='default', rgb_hue=None, ax=None, fignum=None, mean_label='posterior mean', show_mean_label=True, ci=[0.95, 0.99, 0.999], ci_labels=['CI 95%', 'CI 99%', 'CI 99.9%'], show_ci_labels=True, **kwargs)[source]¶
Coverage intervals.
norminv (1 - 0.05/2) = 1.959964 norminv (1 - 0.01/2) = 2.575829 norminv (1 - 0.001/2) = 3.290527
- gpmp.plot.crosssections(model, xi, zi, box, ind_i=None, ind_dim=None, nt=100, show_data=True, figsize=None)[source]¶
Display prediction cross sections.
Each cross section starts from one anchor observation and sweeps one input coordinate through its range while keeping all other coordinates fixed. The posterior mean and coverage intervals are plotted along the slice.
- Parameters:
model (object) – GP model with a
predict(xi, zi, xt)method.xi (array-like) – Observation points, shape
(n, d).zi (array-like) – Scalar observations, shape
(n,)or(n, 1).box (array-like) – Input domain bounds, shape
(2, d).ind_i (sequence of int, int, {"min", "max"}, optional) – Anchor observation indices. If
"min"or"max", use the observation with the smallest or largest scalar value. IfNone, use"min".ind_dim (sequence of int or int, optional) – Input dimensions to sweep. If
None, sweep all dimensions.nt (int, optional) – Number of points per cross section, by default 100.
show_data (bool, optional) – If True, plot observations projected onto each swept coordinate and highlight the anchor observation.
figsize (tuple of float, optional) – Matplotlib figure size. If
None, choose a size from the number of swept dimensions and anchor observations.
- Returns:
GPmp figure object.
- Return type: