Probing
Plotting utilities for probing results.
Requires the plot extra (plotly); the confusion matrix also needs the
probe extra (scikit-learn).
plot_probe_accuracy
Section titled “plot_probe_accuracy”def plot_probe_accuracy(probe: ProbeResult) -> go.Figure:Plot per-layer probe accuracy with cross-validation error bars.
Highlights the best-scoring layer in a distinct color.
Args:
probe: ProbeResult containing per-layer accuracy and CV fold scores.
Returns:
- An interactive Plotly bar chart, one bar per layer.
plot_confusion_matrix
Section titled “plot_confusion_matrix”def plot_confusion_matrix(probe: ProbeResult, store: LabeledActivationStore) -> go.Figure | None:Plot a confusion matrix at the best layer using the refitted classifier.
Args:
probe: ProbeResult with refitted classifiers.store: LabeledActivationStore containing activations and labels.
Returns:
- An interactive Plotly heatmap, or None when the best layer has no
- refitted classifier (e.g. the Probe step ran without
refit=True).