Skip to content

trulens.benchmark.alignment_report

trulens.benchmark.alignment_report

Alignment diagnostics for benchmark and judge-alignment results.

Classes

AlignmentReport

Generate alignment diagnostics for benchmark predictions.

PARAMETER DESCRIPTION
predicted_scores

Predicted judge scores. This may be a one-dimensional sequence, a pandas series, a numpy array, score-confidence pairs, or a TruBenchmarkExperiment result of (scores, meta_scores).

TYPE: Any

true_labels

Ground-truth labels or scores in the same order as the predictions.

TYPE: Any

examples

Optional examples used only when displaying worst misses.

TYPE: Any | None DEFAULT: None

threshold

Threshold used for binary alignment metrics.

TYPE: float DEFAULT: 0.5

thresholds

Optional thresholds for confusion-matrix rows.

TYPE: Sequence[float] | None DEFAULT: None

n_bins

Number of bins for calibration and distribution data.

TYPE: int DEFAULT: 10

top_n

Number of worst misses to include.

TYPE: int DEFAULT: 10

Functions
to_dataframe
to_dataframe() -> dict[str, DataFrame]

Return report sections as pandas dataframes.

print_summary
print_summary() -> str

Print and return a concise console-friendly report.

plot
plot() -> dict[str, Any]

Return matplotlib figures for calibration and score distribution.

to_html
to_html() -> str

Return a single HTML document containing all report sections.