Skip to content

plot_threshold


method plot_threshold(models=None, metric=None, dataset="test", steps=100, title=None, figsize=(10, 6), filename=None, display=True) [source]

Plot metric performances against threshold values. Only for binary classification tasks.

Parameters:

models: str, sequence or None, optional (default=None)
Name of the models to plot. If None, all models in the pipeline are selected.

metric: str, func, scorer, sequence or None, optional (default=None)
Metric to plot. Choose from any of sklearn's SCORERS, a function with signature metric(y_true, y_pred), a scorer object or a sequence of these. If None, the metric used to run the pipeline is plotted.

dataset: str, optional (default="test")
Data set on which to calculate the metric. Choose from: "train", "test", "both" (train and test) or "holdout".

steps: int, optional (default=100)
Number of thresholds measured.

title: str or None, optional (default=None)
Plot's title. If None, the title is left empty.

figsize: tuple, optional (default=(10, 6))
Figure's size, format as (x, y).

filename: str or None, optional (default=None)
Name of the file. Use "auto" for automatic naming. If None, the figure is not saved.

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

Returns: fig: matplotlib.figure.Figure
Plot object. Only returned if display=None.


Example

from atom import ATOMClassifier
from sklearn.metrics import recall_score

atom = ATOMClassifier(X, y)
atom.run("LGB")
atom.plot_threshold(metric=["accuracy", "f1", recall_score])
plot_threshold
Back to top