Results
Result containers for coefficient estimates, multi-field evaluations, bootstrap uncertainty estimates, and hypothesis testing via permutation.
AgreementResult
dataclass
¶
Immutable container holding agreement coefficient estimates and metadata.
Return object of interrater.compute(). Stores point estimates,
optional bootstrap standard errors and BCa confidence intervals.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scores
|
dict[str, float]
|
Map of metric names to point estimate scores (e.g., |
required |
dataset
|
Dataset
|
Underlying |
required |
target
|
str
|
Name of the target annotation column. |
required |
level
|
str
|
Level of measurement. |
required |
n_items
|
int
|
Total number of unique items evaluated. |
required |
n_raters
|
int
|
Total number of unique raters |
required |
coefficients
|
dict[str, AgreementCoefficient]
|
Map of metric names to instantiated |
required |
models
|
list[str]
|
List of unique model names included in the evaluation dataset. |
[]
|
runs
|
list[int]
|
List of unique run identifiers included in the evaluation dataset. |
[]
|
standard_errors
|
dict[str, float]
|
Map of metric names to bootstrap standard error estimates. |
{}
|
ci_ranges
|
dict[str, tuple[float, float]]
|
Map of metric names to |
{}
|
metadata
|
dict[str, Any]
|
Arbitrary key-value user metadata attached to the result. |
{}
|
Attributes:
| Name | Type | Description |
|---|---|---|
metrics |
list[str]
|
List of calculated metric names present in the result. |
Examples:
>>> result = compute(df, target="rating", metrics=["cohen", "ac1"], ci=True)
>>> result.score("cohen")
0.742
>>> result.to_dataframe()
metric score standard_error ci_lower ci_upper ...
0 cohen 0.742 0.031 0.681 0.803
1 ac1 0.810 0.024 0.762 0.858
Source code in interrater/base/result.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 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 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 | |
metrics
property
¶
Return a list of metric names present in this result.
score(metric)
¶
Retrieve the point estimate score for a specific metric.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
metric
|
str
|
Name of the metric. |
required |
Returns:
| Type | Description |
|---|---|
float
|
Point estimate score. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the requested metric was not evaluated in this result. |
Examples:
>>> from interrater.compute import compute
>>> res_gpt5 = compute(
... df=rec_gpt5_dataset.df,
... target="rating",
... metrics=["fleiss", "percent_agreement"],
... ci=True,
... n_boot=1000
... )
>>> res_gpt5.metrics
['fleiss', 'percent_agreement']
Source code in interrater/base/result.py
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 | |
to_dict()
¶
Return a simple dictionary mapping metric names to point estimates.
Returns:
| Type | Description |
|---|---|
dict[str, float]
|
Map of metric names to floating-point scores. |
Source code in interrater/base/result.py
127 128 129 130 131 132 133 134 135 136 | |
to_dataframe()
¶
Convert results into a tidy pandas DataFrame.
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with columns for metric, score, standard_error, ci_lower, ci_upper, target, level, n_items, n_raters, models, dataset, and metadata. |
Examples:
>>> from interrater.compute import compute
>>> res_gpt5 = compute(
... df=rec_gpt5_dataset.df,
... target="rating",
... metrics=["fleiss", "percent_agreement"],
... ci=True,
... n_boot=1000
... )
>>> res_gpt5.to_dict()
{'fleiss': np.float64(0.6923076923076924),
'percent_agreement': 0.8333333333333334}
Source code in interrater/base/result.py
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 | |
select_metrics(metrics)
¶
Create a new AgreementResult restricted to a subset of metrics.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
metrics
|
list[str]
|
List of metric names to retain. |
required |
Returns:
| Type | Description |
|---|---|
AgreementResult
|
A new |
Raises:
| Type | Description |
|---|---|
ValueError
|
If none of the specified metrics exist in the current result. |
Examples:
>>> between = compute(
... rec_dataset.df,
... target="rating",
... metrics=["fleiss", "percent_agreement"],
... models=["gpt-5.4-mini", "gpt-5.4-nano"], # if using all models in the dataset, models doesn't need to be specified
... ci=True,
... n_boot=1000
... )
>>> between.select_metrics(metrics=['fleiss'])
Source code in interrater/base/result.py
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 | |
MultiAgreementResult
dataclass
¶
Immutable container holding agreement results across multiple categories or fields.
Return object of interrater.compute_many(). Maps category names to individual
AgreementResult instances and provides collection-level utilities.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
results
|
dict[str, AgreementResult]
|
Map of field/category strings to |
required |
Attributes:
| Name | Type | Description |
|---|---|---|
fields |
list[str]
|
List of field or category names stored in this result. |
metrics |
list[str]
|
Sorted list of unique metric names evaluated across all fields. |
Examples:
>>> multi_res = compute_many(ds, fields=["field_a", "field_b"], metrics=["fleiss"])
>>> multi_res["field_a"].scores
{'fleiss': 0.68}
>>> df = multi_res.to_dataframe()
Source code in interrater/base/result.py
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 | |
fields
property
¶
Return list of evaluated field/category names.
metrics
property
¶
Return sorted list of unique metric names evaluated across all fields.
to_dataframe()
¶
Convert all field results into a single consolidated pandas DataFrame.
Returns:
| Type | Description |
|---|---|
DataFrame
|
Concatenated DataFrame where each row contains its associated |
Source code in interrater/base/result.py
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 | |
concat(*results)
classmethod
¶
Combine multiple MultiAgreementResult objects into a single result container.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*results
|
MultiAgreementResult
|
One or more |
()
|
Returns:
| Type | Description |
|---|---|
MultiAgreementResult
|
A unified |
Raises:
| Type | Description |
|---|---|
ValueError
|
If duplicate field names exist across the provided results. |
Examples:
>>> nominal = compute_many(ds, fields=["field_a", "field_b"], metrics=["fleiss"])
>>> set = compute_many(ds, fields=["field_a", "field_b"], metrics=["jaccard"])
>>> combined = MultiAgreementResult.concat(nominal, set)
Source code in interrater/base/result.py
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 | |
extend(other)
¶
Return a new MultiAgreementResult combining fields from self and other.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other
|
MultiAgreementResult
|
Secondary result set to combine with. |
required |
Returns:
| Type | Description |
|---|---|
MultiAgreementResult
|
A new merged instance. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If duplicate field names exist between the two objects. |
Examples:
>>> nominal = compute_many(ds, fields=["field_a", "field_b"], metrics=["fleiss"])
>>> set = compute_many(ds, fields=["field_a", "field_b"], metrics=["jaccard"])
>>> combined = nominal.extend(set)
Source code in interrater/base/result.py
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 | |
select_metrics(metrics)
¶
Return a new MultiAgreementResult filtered to include only selected metrics.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
metrics
|
list[str]
|
List of metric names to retain. |
required |
Returns:
| Type | Description |
|---|---|
MultiAgreementResult
|
Filtered |
Source code in interrater/base/result.py
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 | |
select_fields(fields)
¶
Return a new MultiAgreementResult filtered to include only selected fields.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fields
|
list[str]
|
List of field or category names to keep. |
required |
Returns:
| Type | Description |
|---|---|
MultiAgreementResult
|
Filtered |
Raises:
| Type | Description |
|---|---|
ValueError
|
If none of the requested fields are present. |
Source code in interrater/base/result.py
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 | |
aggregate_runs()
¶
Aggregate estimates across runs for each model.
Calculates mean std, min, and max across runs for each metric and model.
Returns:
| Type | Description |
|---|---|
DataFrame
|
Summary dataframe grouped by model and metric |
Source code in interrater/base/result.py
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 | |
EvaluationResult
dataclass
¶
Significance evaluation result for a single agreement metric comparison.
Represents hypothesis test outputs generated by interrater.evaluate() for one metric.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
metric
|
str
|
Name of the evaluated agreement metric. |
required |
estimate
|
float
|
Observed estimate (point estimate for one-sample, or difference for two-sample). |
required |
p_value
|
float
|
Permutation test \(p\)-value. |
required |
null_distribution
|
ndarray
|
1D array holding permutation null statistics. |
required |
alternative
|
str
|
Direction of alternative hypothesis ( |
required |
method
|
str
|
Permutation computation method ( |
required |
label_a
|
str
|
Model identifier for |
required |
label_b
|
str or None
|
Model identifier for |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
raters |
str
|
Formatted string listing participating models, e.g., |
Source code in interrater/base/result.py
476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 | |
raters
property
¶
Formatted display string with rater names.
is_significant(alpha=0.05)
¶
Check if the hypothesis test is statistically significant at significance level \(\alpha\).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha
|
float
|
Significance threshold \(\alpha\). |
0.05
|
Returns:
| Type | Description |
|---|---|
bool
|
|
Source code in interrater/base/result.py
523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 | |
EvaluationResults
dataclass
¶
Container for multiple metric evaluation results from hypothesis testing.
Return object of interrater.evaluate(). Contains a list of EvaluationResult objects
and includes convenience methods for filtering, tabular formatting, null distribution
plotting and inspection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
results
|
list[EvaluationResult]
|
Collection of individual metric evaluation results. |
required |
Attributes:
| Name | Type | Description |
|---|---|---|
metrics |
list[str]
|
Sorted list of unique metric names contained in the results. |
Examples:
>>> eval_results = evaluate(res_a, res_b)
>>> eval_results.significant(alpha=0.01)
<EvaluationResults containing 1 significant result>
>>> df = eval_results.to_dataframe()
Source code in interrater/base/result.py
539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 | |
metrics
property
¶
Return a sorted list of unique evaluated metric names.
to_dataframe(alpha=0.05)
¶
Convert evaluation results into a structured pandas DataFrame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha
|
float
|
Significance threshold \(\alpha\) used to populate the boolean |
0.05
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame listing raters, metric, estimate, \(p\)-value, significance status, null mean/std, hypothesis alternative, and computation method. |
Source code in interrater/base/result.py
578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 | |
select_metrics(metrics)
¶
Return a new EvaluationResults restricted to specified metric names.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
metrics
|
list[str]
|
List of metric names to retain. |
required |
Returns:
| Type | Description |
|---|---|
EvaluationResults
|
New filtered |
Raises:
| Type | Description |
|---|---|
ValueError
|
If none of the requested metrics exist. |
Source code in interrater/base/result.py
608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 | |
significant(alpha=0.05)
¶
Filter and return results that meet statistical significance (\(p < \alpha\)).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha
|
float
|
Significance threshold \(\alpha\). |
0.05
|
Returns:
| Type | Description |
|---|---|
EvaluationResults
|
A new |
Source code in interrater/base/result.py
637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 | |
plot_distribution(metric, bins=30, figsize=(7, 5))
¶
Plot a histogram of the permutation null distribution alongside the observed estimate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
metric
|
str
|
Name of the metric comparison to plot. |
required |
bins
|
int
|
Number of histogram bins. |
30
|
figsize
|
tuple[int, int]
|
Dimensions of the generated figure (width, height). |
(7, 5)
|
Returns:
| Type | Description |
|---|---|
Axes
|
Matplotlib Axes instance containing the plotted distribution. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no comparison is found for the requested metric, or if multiple comparisons share the same metric name. |
Source code in interrater/base/result.py
655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 | |
inspect(metric, tolerance=1e-10)
¶
Inspect properties of the null distribution for a specific metric.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
metric
|
str
|
Name of the metric to inspect. |
required |
tolerance
|
float
|
Absolute tolerance used when counting null values close to the observed statistic. |
1e-10
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame summarizing observed statistic, null min/max/mean/std, and count of null permutations near observed value. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the metric does not uniquely identify exactly one comparison result. |
Source code in interrater/base/result.py
709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 | |
BootstrapResult
dataclass
¶
Immutable container for standard error and confidence interval bounds derived from bootstrapping.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
standard_error
|
float
|
Estimated standard error of the agreement statistic. |
required |
ci_lower
|
float
|
Lower bound of the non-parametric BCa confidence interval. |
required |
ci_upper
|
float
|
Upper bound of the non-parametric BCa confidence interval. |
required |
Source code in interrater/base/result.py
758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 | |
PermutationResult
dataclass
¶
Output summary of a raw permutation test run.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
observed_difference
|
float
|
The observed test statistic or score difference. |
required |
p_value
|
float
|
Calculated \(p\)-value under the permutation null distribution. |
required |
null_distribution
|
ndarray
|
Array containing all null test statistics computed during permutation resampling. |
required |
alternative
|
str
|
Direction of hypothesis test ( |
required |
method
|
str
|
Resampling execution method ( |
required |
n_resamples
|
int
|
Number of permutations evaluated. |
required |
Source code in interrater/base/result.py
776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 | |
:::