from inspect_viz import Data
from inspect_viz.view.beta import scores_heatmap
evals = Data.from_file("evals.parquet")
scores_heatmap(evals, height=200)Scores Heatmap
Overview
The scores_heatmap()function renders a heatmap for comparing eval scores.
Data Preparation
Above we read the data for the plot from a parquet file. This file was in turn created by:
Reading logs into a data frame with
evals_df().Using the
prepare()function to addmodel_info()andlog_viewer()columns to the data frame.
from inspect_ai.analysis import evals_df, log_viewer, model_info, prepare
df = evals_df("logs")
df = prepare(df, [
model_info(),
log_viewer("eval", {"logs": "https://samples.meridianlabs.ai/"})
])
df.to_parquet("evals.parquet")You can additionally use the task_info() operation to map lower-level task names to task display names (e.g. “gpqa_diamond” -> “GPQA Diamond”).
Note that both the log viewer links and model names are optional (the plot will render without links and use raw model strings if the data isn’t prepared with log_viewer() and model_info()).
Function Reference
Creates a heatmap plot of success rate of eval data.
def scores_heatmap(
data: Data,
task_name: str = "task_display_name",
task_label: str | None | NotGiven = None,
model_name: str = "model_display_name",
model_label: str | None | NotGiven = None,
score_value: str = "score_headline_value",
cell: CellOptions | None = None,
tip: bool = True,
title: str | Title | None = None,
marks: Marks | None = None,
height: float | None = None,
width: float | None = None,
legend: Legend | NotGiven | None = NOT_GIVEN,
sort: Literal["ascending", "descending"] | SortOrder | None = "ascending",
orientation: Literal["horizontal", "vertical"] = "horizontal",
**attributes: Unpack[PlotAttributes],
) -> ComponentdataData-
Evals data table.
task_namestr-
Name of column to use for columns.
task_labelstr | None | NotGiven-
x-axis label (defaults to None).
model_namestr-
Name of column to use for rows.
model_labelstr | None | NotGiven-
y-axis label (defaults to None).
score_valuestr-
Name of the column to use as values to determine cell color.
cellCellOptions | None-
Options for the cell marks.
tipbool-
Whether to show a tooltip with the value when hovering over a cell (defaults to True).
titlestr | Title | None-
Title for plot (
stror mark created with the title() function) marksMarks | None-
Additional marks to include in the plot.
heightfloat | None-
The outer height of the plot in pixels, including margins. The default is width / 1.618 (the golden ratio).
widthfloat | None-
The outer width of the plot in pixels, including margins. Defaults to 700.
legendLegend | NotGiven | None-
Options for the legend. Pass None to disable the legend.
sortLiteral['ascending', 'descending'] | SortOrder | None-
Sort order for the x and y axes. If ascending, the highest values will be sorted to the top right. If descending, the highest values will appear in the bottom left. If None, no sorting is applied. If a SortOrder is provided, it will be used to sort the x and y axes.
orientationLiteral['horizontal', 'vertical']-
The orientation of the heatmap. If “horizontal”, the tasks will be on the x-axis and models on the y-axis. If “vertical”, the tasks will be on the y-axis and models on the x-axis.
**attributesUnpack[PlotAttributes]-
Additional `PlotAttributes
Implementation
The Scores Heatmap example demonstrates how this view was implemented using lower level plotting components.