Skip to content

plot_slice


method plot_slice(models=None, params=None, metric=None, title=None, legend=None, figsize=None, filename=None, display=True)[source]
Plot the parameter relationship in a study.

The color of the markers indicates the trial. This plot is only available for models that ran hyperparameter tuning.

Parametersmodels: int, str, Model or None, default=None
Model to plot. If None, all models are selected. Note that leaving the default option could raise an exception if there are multiple models. To avoid this, call the plot directly from a model, e.g., atom.lr.plot_slice().

params: str, segment, sequence or None, default=None
Hyperparameters to plot. Use a sequence or add + between options to select more than one. If None, all the model's hyperparameters are selected.

metric: int or str, default=None
Metric to plot (only for multi-metric runs). If str, add + between options to select more than one. If None, the metric used to run the pipeline is selected.

title: str, dict or None, default=None
Title for the plot.

legend: str, dict or None, default=None
Do nothing. Implemented for continuity of the API.

figsize: tuple or None, default=None
Figure's size in pixels, format as (x, y). If None, it adapts the size to the number of hyperparameters shown.

filename: str, Path or None, default=None
Save the plot using this name. Use "auto" for automatic naming. The type of the file depends on the provided name (.html, .png, .pdf, etc...). If filename has no file type, the plot is saved as html. If None, the plot is not saved.

display: bool or None, default=True
Whether to render the plot. If None, it returns the figure.

Returnsgo.Figure or None
Plot object. Only returned if display=None.


See Also

plot_edf

Plot the Empirical Distribution Function of a study.

plot_hyperparameters

Plot hyperparameter relationships in a study.

plot_parallel_coordinate

Plot high-dimensional parameter relationships in a study.


Example

>>> from atom import ATOMClassifier
>>> from sklearn.datasets import load_breast_cancer

>>> X, y = load_breast_cancer(return_X_y=True, as_frame=True)

>>> atom = ATOMClassifier(X, y, random_state=1)
>>> atom.run(
...     models="RF",
...     metric=["f1", "recall"],
...     n_trials=15,
... )
>>> atom.plot_slice(params=(0, 1, 2))