Result Analysers
Comparing experiment configurations
The standard summary has one row per stored generation configuration with aggregate metrics. Compare or join rows by generation_id. Two rows can share the same model name, dataset and other display labels. For example, the same model run at temperatures 0 and 1 has two generation IDs. The ID identifies a configuration and can recur across runs of that configuration.
dataset_version and experiment_name give human-readable context. To inspect a row's temperature in an existing project, use the ID from the table:
import json
for record in project.records.evaluation:
if record.generation_id == selected_id:
settings = json.loads(record.model_record.generation_args_json)
print(record.evaluator_name, settings.get("temperature"))
Evaluators that score the same generation appear side by side. A unique metric keeps its usual score/metric column name. When several recorded aggregates share that name, their column labels include the evaluator name and an identifier derived from their settings. A missing combination has a null cell. A repeated value for the same generation and aggregate raises an error even when both scores are equal. The analyser also checks for incompatible metric implementations before building the table.
Older projects use the identity fields present in their records. If two runs were already saved under the same record, the summary cannot recover the missing distinction. Rerun the summary from the saved evaluation logs to update a previously exported table.
Modules:
| Name | Description |
|---|---|
meta_result_analyser |
|
metric_correlation_analyser |
|
tabular_analyser |
|
Classes:
| Name | Description |
|---|---|
CorrelationResults |
Correlation matrices and counts, with the same metric order in each table. |
MetaResultAnalyser |
Describe within-sample rank agreement across a declared complete tier set. |
MetricCorrelationAnalyser |
Correlate scores on the same generated observations. |
TabularResultAnalyser |
An analyser summarising evaluation results in a tabular format. |
CorrelationResults
dataclass
Correlation matrices and counts, with the same metric order in each table.
Attributes:
| Name | Type | Description |
|---|---|---|
correlation_matrix |
T
|
Pairwise coefficients in the requested output format. |
figure |
Figure | None
|
Correlation plot, or None when no plot was produced. |
paired_counts |
T | None
|
Number of finite, identity-matched observations used for each coefficient. Populated by MetricCorrelationAnalyser. |
excluded_counts |
T | None
|
Number of identity-matched pairs excluded because either score is non-finite. Unmatched observations are not included in either count. Populated by MetricCorrelationAnalyser. |
Source code in evalsense/workflow/analysers/metric_correlation_analyser.py
MetaResultAnalyser
Bases: ResultAnalyser[T]
Describe within-sample rank agreement across a declared complete tier set.
For three or more planned tiers, each sample contributes one Spearman
correlation. A deliberately two-tier design instead reports pairwise ordering:
pairwise_accuracy is concordant / (concordant + discordant), and
avg_correlation is 2 * pairwise_accuracy - 1. analysis_kind identifies
the design. Equal-score pairs are undefined correlations, excluded and counted
in n_constant; pairwise accuracy is conditional on non-tied, usable pairs.
A missing tier never changes the declared design or selects pairwise analysis.
The reported mean gives included samples equal weight. Results are kept
separate by dataset, task, generating model, evaluator configuration and scorer;
only the tier generator is grouped out. group_id is a stable digest of
that grouped record; full configurations remain in the project. Aliases
change presentation only.
Counts cover the union of sample IDs in available evaluation logs, including
failed logs, or an explicit expected_sample_ids manifest. Samples absent
from every log cannot be counted without that manifest. Missing logs are
reported separately. Scores from unsuccessful records/logs are not used.
Exclusion reasons are mutually exclusive, checked in this order: incomplete
tiers, missing/failed scores, invalid/non-finite values, missing validation,
constant scores, undefined correlation. No score is imputed or set to zero.
For three or more tiers, confidence limits use a percentile bootstrap of
included sample-level correlations, never of individual tiers. Those intervals
are unavailable for fewer than two included samples or degenerate distributions.
Two-tier designs use Wilson binomial limits for the ordering accuracy, mapped
to the mean-correlation scale as 2 * limit - 1. They are defined even for one
non-tied pair or unanimous pairs; no usable pairs gives no estimate or interval.
ci_low and ci_high are always on the avg_correlation scale.
Both interval methods assume independent sample IDs and are conditional on retained samples and the tier design. They do not correct selection bias, establish clinical validity, or quantify uncertainty in generated severity. Small samples and few tiers provide limited evidence; a perfect mean alone is not evidence of a reliable evaluator.
Generated tier IDs specify intended severity, not independently verified
severity. By default results carry validation_policy='not_checked' and a
warning. tier_validation_field requires caller-supplied True flags on all
tiers of a sample, after independent review of the actual generated outputs.
These flags are attestations, not validation performed by this analyser.
Duplicate sample/tier observations and multiple epochs within a cohort raise ValueError. Repeated measurements need a separate, explicit aggregation policy.
Methods:
| Name | Description |
|---|---|
__call__ |
Summarise complete, finite tier comparisons with explicit evidence counts. |
__init__ |
Initialise the analyser. |
Source code in evalsense/workflow/analysers/meta_result_analyser.py
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 | |
__call__
__call__(
project: Project,
meta_tier_field: str = "perturbation_type_tier",
lower_tier_is_better: bool = False,
metric_labels: dict[str, str] | None = None,
*,
expected_tiers: Sequence[int],
expected_sample_ids: Sequence[str | int] | None = None,
tier_validation_field: str | None = None,
confidence_level: float = 0.95,
n_resamples: int = 2000,
seed: int = 0,
**kwargs: dict,
) -> T
Summarise complete, finite tier comparisons with explicit evidence counts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project
|
Project
|
Project containing the evaluation logs. |
required |
meta_tier_field
|
str
|
Metadata field containing integer tier IDs. |
'perturbation_type_tier'
|
lower_tier_is_better
|
bool
|
True when lower tiers mean better outputs. All analysed metrics must be oriented so higher scores are better. |
False
|
metric_labels
|
dict[str, str] | None
|
Display aliases for original scalar scorer or inner metric names. Does not combine identities. |
None
|
expected_tiers
|
Sequence[int]
|
Complete planned tier set, with at least two distinct integers. Two tiers select pairwise-ordering analysis; three or more select mean Spearman correlation. Never inferred from surviving results. |
required |
expected_sample_ids
|
Sequence[str | int] | None
|
Optional full sample manifest, applied to each cohort. IDs must be unique and cover all observations. Without it, counts describe observed IDs only. |
None
|
tier_validation_field
|
str | None
|
Optional metadata field containing the boolean True after external review of each generated output's assigned tier. Missing/false flags exclude the whole sample. |
None
|
confidence_level
|
float
|
Two-sided confidence level in (0, 1). |
0.95
|
n_resamples
|
int
|
Bootstrap resamples for three or more tiers, at least 1000. Defaults to 2000. Unused for two-tier designs. |
2000
|
seed
|
int
|
Non-negative bootstrap seed. Defaults to 0. Unused for two-tier designs. |
0
|
**kwargs
|
dict
|
Unused arguments accepted for ResultAnalyser compatibility. |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
T |
T
|
One row per cohort/scorer/metric, with the mean correlation, interval, interval status, included/excluded counts, exclusion reasons and analysis settings. Two-tier rows include concordant/discordant counts and accuracy; bootstrap-only settings are null. Unestimable values are null. Cohorts without any recorded metrics have a null metric row. Empty projects return a typed empty table. Neither logs nor project records are modified. |
Raises:
| Type | Description |
|---|---|
ValueError
|
For invalid settings, invalid/unexpected tiers, IDs outside the manifest, duplicate sample/tier observations or mixed epochs. |
Source code in evalsense/workflow/analysers/meta_result_analyser.py
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 | |
__init__
__init__(
name: str = "MetaResultAnalyser",
output_format: Literal["polars", "pandas"] = "polars",
)
Initialise the analyser.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Name of the analyser. |
'MetaResultAnalyser'
|
output_format
|
Literal['polars', 'pandas']
|
Result table format. |
'polars'
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If the output format is unsupported. |
Source code in evalsense/workflow/analysers/meta_result_analyser.py
MetricCorrelationAnalyser
Bases: ResultAnalyser[T]
Correlate scores on the same generated observations.
Pairing uses the full generation record, source Inspect eval_id, sample ID
(including its type), and epoch. Older logs without eval_id require both
run_id and task_id. Copies of the same generation can be compared across
evaluators; independent generation attempts are not paired by sample ID alone.
Evaluator, scorer and inner-metric identities remain separate from display labels. Names are qualified when needed; ambiguous labels raise ValueError rather than merge distinct metrics. Retained evaluator configurations can share display names even when their identities differ.
Non-finite scores are excluded pairwise and counted. Fewer than two finite pairs or a constant vector produces NaN, including on the diagonal. Pairwise exclusion does not establish unbiased missingness; these are descriptive correlations without confidence estimates.
All tables use the same metric order and requested output format. The first
column, Metric, contains row labels, including in NumPy output. Empty
selections return empty tables and no figure. See CorrelationResults for the
definitions of paired_counts and excluded_counts.
Methods:
| Name | Description |
|---|---|
__call__ |
Calculate pairwise correlations after joining observation identities. |
__init__ |
Initialise the metric correlation analyser. |
Source code in evalsense/workflow/analysers/metric_correlation_analyser.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 | |
__call__
__call__(
project: Project,
corr_method: Literal[
"spearman", "pearson"
] = "spearman",
return_plot: bool = True,
figsize: tuple[int, int] = (12, 10),
metric_labels: dict[str, str] | None = None,
method_filter_fun: Callable[[str], bool] = lambda _: (
True
),
**kwargs: dict,
) -> T
Calculate pairwise correlations after joining observation identities.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project
|
Project
|
Project containing the successful evaluation logs to analyse. |
required |
corr_method
|
Literal['spearman', 'pearson']
|
Correlation method. Defaults to "spearman". |
'spearman'
|
return_plot
|
bool
|
Whether to include a correlation plot when metrics are selected. Defaults to True. |
True
|
figsize
|
tuple[int, int]
|
Plot dimensions. Defaults to (12, 10). |
(12, 10)
|
metric_labels
|
dict[str, str] | None
|
Map original scalar scorer names or inner metric names to display aliases in all tables and the plot. Aliases do not change observation identity. Defaults to None. |
None
|
method_filter_fun
|
Callable[[str], bool]
|
Include a numeric metric when this function returns True for its original scalar scorer name or inner metric name, before aliasing. Defaults to including all numeric metrics. |
lambda _: True
|
**kwargs
|
dict
|
Additional analyser-interface arguments. Unused. |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
T |
T
|
CorrelationResults containing correlation_matrix, paired_counts and excluded_counts in the requested output format, and an optional figure. Empty selections produce empty tables and no figure. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If corr_method is unsupported, source identity is missing, a metric/observation key is duplicated (even with equal scores), or display labels are ambiguous or use the reserved name "Metric". |
Source code in evalsense/workflow/analysers/metric_correlation_analyser.py
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 | |
__init__
__init__(
name: str = "MetricCorrelationAnalyser",
output_format: Literal[
"polars", "pandas", "numpy"
] = "polars",
)
Initialise the metric correlation analyser.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Analyser name. Defaults to "MetricCorrelationAnalyser". |
'MetricCorrelationAnalyser'
|
output_format
|
Literal['polars', 'pandas', 'numpy']
|
Format of all result tables. Defaults to "polars". |
'polars'
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If output_format is unsupported. |
Source code in evalsense/workflow/analysers/metric_correlation_analyser.py
TabularResultAnalyser
Bases: ResultAnalyser[T]
An analyser summarising evaluation results in a tabular format.
This class is generic in T to provide better type hints when returning
different output types. It is the responsibility of the client code to
ensure that the specified output_format is compatible with the type T.
For example, a correct use of this class could look as follows:
analyser = TabularResultAnalyser[pl.DataFrame](
output_format="polars",
)
Methods:
| Name | Description |
|---|---|
__call__ |
Summarise successful evaluation logs by stored generation configuration. |
__init__ |
Initializes the tabular result analyser. |
Source code in evalsense/workflow/analysers/tabular_analyser.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | |
__call__
Summarise successful evaluation logs by stored generation configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project
|
Project
|
The project holding the evaluation data to analyse. |
required |
**kwargs
|
dict
|
Additional arguments for the analysis. |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
T |
T
|
One row per generation ID with available aggregate metrics. Metrics for different evaluators share a row when their generation matches. A project without aggregates returns just the identity columns. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If an aggregate is duplicated for a generation, if metric labels remain ambiguous, or if metric implementations conflict. |
Source code in evalsense/workflow/analysers/tabular_analyser.py
__init__
__init__(
name: str = "TabularResultAnalyser",
output_format: Literal["polars", "pandas"] = "polars",
)
Initializes the tabular result analyser.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the tabular result analyser. |
'TabularResultAnalyser'
|
output_format
|
Literal['polars', 'pandas', 'dataset']
|
The output format of the result. Can be "polars" or "pandas". Defaults to "polars". |
'polars'
|