Matplotlib plots for reading, comparing and reporting evaluation results.
This package turns the numbers produced by metrics and statistics into publication-quality figures. Reach for it at the end of an experiment, when you already have predictions or a score matrix and want to see — or publish — what they say.
Two families of plots live here:
Single-model diagnostics — you have one fitted model and its predictions on a test set:
plot_confusion_matrix — which classes
plot_roc_curve /
plot_pr_curve — threshold-free ranking quality; the PR curve is the one to trust on imbalanced data.
plot_learning_curve — whether more
plot_tree — the structure of a fitted
Multi-model comparison — you have a (n_datasets, n_algorithms) score matrix from a benchmark:
plot_critical_difference — the
plot_ranking_table — the raw numbers
plot_boxplot_comparison — score spread
plot_heatmap — the whole score matrix
All plotting functions share the same conventions: matplotlib is imported lazily, so they raise ImportError if it is unavailable; each one calls matplotlib.pyplot.show() before returning, and writes a 300-dpi PNG when a save_path is supplied. Styling comes from a shared internal stylesheet whose palettes (PALETTES) and semantic colour tokens (SEMANTIC_COLORS) are re-exported here, together with the helpers apply_style, reset_style, get_colors, setup_figure and style_axis for building your own matching figures.
seaborn is an optional accelerant: when installed, plot_confusion_matrix and plot_heatmap render through seaborn.heatmap; otherwise they fall back to plain matplotlib and look slightly different. Nothing here requires it.>>> import numpy as np
>>> from tuiml.evaluation.visualization import plot_confusion_matrix
>>> y_true = np.array([0, 1, 1, 0, 2, 2, 1])
>>> y_pred = np.array([0, 1, 0, 0, 2, 1, 1])
>>> cm = plot_confusion_matrix(y_true, y_pred) # doctest: +SKIP
Critical Difference (CD) diagrams: the standard way to report a benchmark of many algorithms over ma...
Model comparison visualizations.
Confusion matrix visualization.
Diagnostic curves for a single fitted model: ROC, precision-recall, and learning curves....
Render fitted TuiML decision trees as figures, ASCII text, or GraphViz DOT....