plot.contour.plotModel

plot.contour.plotModel(
    model,
    lower,
    upper,
    i=0,
    j=1,
    min_z=None,
    max_z=None,
    var_type=None,
    var_name=None,
    show=True,
    filename=None,
    n_grid=50,
    contour_levels=10,
    dpi=200,
    title='',
    figsize=(12, 6),
    use_min=False,
    use_max=False,
    aspect_equal=True,
    legend_fontsize=12,
    cmap='viridis',
    X_points=None,
    y_points=None,
    plot_points=True,
    points_color='white',
    points_size=30,
    point_color_below='blue',
    point_color_above='red',
    atol=1e-06,
    plot_3d=False,
)

Generate 2D contour and optionally 3D surface plots for a model’s predictions.

Parameters

Name Type Description Default
model object A model with a predict method. required
lower array_like Lower bounds for each dimension. required
upper array_like Upper bounds for each dimension. required
i int Index for the x-axis dimension. 0
j int Index for the y-axis dimension. 1
min_z float Min value for color scaling. Defaults to None. None
max_z float Max value for color scaling. Defaults to None. None
var_type list Variable types for each dimension. Defaults to None. None
var_name list Variable names for labeling axes. Defaults to None. None
show bool Whether to display the plot. Defaults to True. True
filename str File path to save the figure. Defaults to None. None
n_grid int Resolution for each axis. Defaults to 50. 50
contour_levels int Number of contour levels. Defaults to 10. 10
dpi int DPI for saving. Defaults to 200. 200
title str Title for the figure. Defaults to ““. ''
figsize tuple Figure size. Defaults to (12, 6). (12, 6)
use_min bool If True, leftover dims are set to lower bounds. False
use_max bool If True, leftover dims are set to upper bounds. False
aspect_equal bool Whether axes have equal scaling. Defaults to True. True
legend_fontsize int Font size for labels and legends. Defaults to 12. 12
cmap str Colormap. Defaults to “viridis”. 'viridis'
X_points ndarray Original data points. Shape: (N, D). None
y_points ndarray Original target values. Shape: (N,). None
plot_points bool Whether to plot X_points. Defaults to True. True
points_color str Fallback color for data points. Defaults to “white”. 'white'
points_size int Marker size for data points. Defaults to 30. 30
point_color_below str Color if actual z < predicted z. Defaults to “blue”. 'blue'
point_color_above str Color if actual z >= predicted z. Defaults to “red”. 'red'
atol float Absolute tolerance for comparing actual and predicted z-values. Defaults to 1e-6. 1e-06
plot_3d bool Whether to plot the 3D surface plot. Defaults to False. False

Returns

Name Type Description
(fig, (ax_contour, ax_surface)) Figure and axes for the contour and surface plots.