Visualization via the skore display API#
skore provides a family of objects that we call displays. All displays follow the
common API defined by the Display protocol. As a user, you get a display by
interacting with a reporter. Let’s provide an example:
from sklearn.datasets import make_classification
from sklearn.linear_model import LogisticRegression
from skore import CrossValidationReport
X, y = make_classification(
n_samples=10_000,
n_classes=3,
class_sep=0.3,
n_clusters_per_class=1,
random_state=42,
)
report = CrossValidationReport(LogisticRegression(), X, y)
disp = report.metrics.roc()
disp.plot()
The EstimatorReport.metrics.roc() creates a RocCurveDisplay object. The
first available method with the skore display is a plot method. It shows graphically
the information contained in the display. Call it as many times as you want - it does
not modify the display object nor require heavy computation.
disp.plot()
The plot method can be preceded by the set_style method which accepts parameters to
tweak the rendering of the display. For instance, customize the appearance of the chance level:
disp.set_style(
chance_level_kwargs=dict(linestyle="-", linewidth=5, color="tab:purple")
)
disp.plot()
Any subsequent call to plot uses the style settings set by set_style.