TableReportDisplay#

class skore.TableReportDisplay(summary)[source]#

Summarize and plot dataset columns.

Parameters:
summarydict

The summary of the dataset, as returned by summarize_dataframe.

Attributes:
summarydict

Dataset summary produced by skrub’s summarize_dataframe.

See also

EstimatorReport.data.summarize

Create this display from a report.

Examples

>>> from sklearn.datasets import load_breast_cancer
>>> from sklearn.linear_model import LogisticRegression
>>> from skore import evaluate
>>> X, y = load_breast_cancer(return_X_y=True)
>>> classifier = LogisticRegression(max_iter=10_000)
>>> report = evaluate(classifier, X, y, splitter=0.2)
>>> display = report.data.summarize()
>>> display.plot(kind="corr")
frame(*, kind='dataset')[source]#

Get the data related to the table report.

Parameters:
kind{‘dataset’, ‘top-associations’}

The kind of data to return.

Returns:
UserDataFrame or pd.DataFrame

When kind="dataset", the dataframe is returned in the user’s native backend (pandas or polars). When kind="top-associations", a pandas DataFrame of column associations is returned.

help()[source]#

Display display help using rich or HTML.

plot(*, x=None, y=None, hue=None, kind='dist', top_k_categories=20)[source]#

Plot distribution or correlation of the columns from the dataset.

Parameters:
xstr, default=None

The name of the column to use for the x-axis of the plot. Mandatory when kind='dist'.

ystr, default=None

The name of the column to use for the y-axis of the plot. Only used when kind='dist'.

huestr, default=None

The name of the column to use for the color or hue axis of the plot. Only used when kind='dist'.

kind{‘dist’, ‘corr’}, default=’dist’

The kind of plot drawn.

  • If 'dist', plot a distribution parametrized by x, y and hue. When only x is defined, the distribution is 1d. When y is also defined, the plot is the 2d. Finally, when the color is set using hue, the distribution is 2d, with a color per data-point based on hue. This mode handle both numeric and categorical columns.

  • If 'corr', plot Cramer’s V correlation among all columns. This option doesn’t take any x, y or hue argument.

top_k_categoriesint, default=20

For categorical columns, the number of most frequent elements to display. Only used when kind='dist'.

Returns:
matplotlib.figure.Figure

Figure containing the plot.

Examples

>>> from sklearn.datasets import load_breast_cancer
>>> from sklearn.linear_model import LogisticRegression
>>> from skore import evaluate
>>> X, y = load_breast_cancer(return_X_y=True)
>>> classifier = LogisticRegression(max_iter=10_000)
>>> report = evaluate(classifier, X, y, splitter=0.2)
>>> display = report.data.summarize()
>>> display.plot(kind="corr")
set_style(*, policy='update', scatterplot_kwargs=None, stripplot_kwargs=None, boxplot_kwargs=None, heatmap_kwargs=None, histplot_kwargs=None)[source]#

Set the style parameters for the display.

Parameters:
policyLiteral[“override”, “update”], default=”update”

Policy to use when setting the style parameters. If “override”, each provided group replaces the previous value. Omitted groups are left unchanged. If “update”, merge provided values into the existing settings. Passed keys replace the previous value. Nested dictionaries are merged the same way, so omitted keys are kept.

scatterplot_kwargs: dict, default=None

Keyword arguments to be passed to seaborn.scatterplot() for rendering the distribution 2D plot, when both x and y are numeric.

stripplot_kwargs: dict, default=None

Keyword arguments to be passed to seaborn.stripplot() for rendering the distribution 2D plot, when either x or y is numeric, and the other is categorical. This plot is drawn on top of the boxplot.

boxplot_kwargs: dict, default=None

Keyword arguments to be passed to seaborn.boxplot() for rendering the distribution 2D plot, when either x or y is numeric, and the other is categorical. This plot is drawn below the stripplot.

heatmap_kwargs: dict, default=None

Keyword arguments to be passed to seaborn.heatmap() for rendering Cramer’s V correlation matrix, when kind='corr' or when kind='dist' and both x and y are categorical.

histplot_kwargs: dict, default=None

Keyword arguments to be passed to seaborn.histplot() for rendering the distribution 1D plot, when only x is provided.

Returns:
None
Raises:
ValueError

If a style parameter is unknown.

static style_plot(plot_func)[source]#

Apply consistent style to skore displays.

This decorator: 1. Applies default style settings 2. Runs plot_func under plt.ioff() so figures are not shown until returned 3. Calls Figure.tight_layout() on the returned figure when applicable 4. Restores the original style settings

Parameters:
plot_funccallable

The plot function to be decorated.

Returns:
callable

The decorated plot function.