A robust implementation of Krippendorff's Alpha for inter-annotator agreement
Project description
Krippendorff's Alpha
A Python implementation of Krippendorff's Alpha, a statistical measure of inter-rater reliability designed for various data types (Nominal, Ordinal, Interval, and Ratio).
✔️ Support for multiple data types (Nominal, Ordinal, etc.)
✔️ Custom weights for annotator impact on annotation assignments
✔️ Performance optimizations
✔️ Fine-grained output for categorical values
This project is inspired by the following open-source implementations of Krippendorff's Alpha listed below:
Setup
This project uses UV for dependency management.
Steps:
Install UV using UV Install Guide
After installing UV, you can then follow the instruction below.
Run:
uv run
Set Python interpreter in IDE:
.venv/bin/python3.13
Note: This project requires Python 3.13 or higher.
Done. You're set up!
Project Structure
Project Structure Overview
The project is structured to ensure modularity, scalability, and ease of use. Below is a breakdown of the key components:
-
src/krippendorff_alpha/
Contains the core implementation of Krippendorff's Alpha, including modules for preprocessing, reliability computation, and metric calculation. -
datasets/
Contains example datasets in TSV format to demonstrate the usage of Krippendorff's Alpha for different data types (nominal, ordinal, interval, ratio). -
notebooks/
Contains usability examples for the code.
Installation
pip install krippendorff-aleph-alpha
Or using UV:
uv add krippendorff-aleph-alpha
Usage
import pandas as pd
from krippendorff_alpha import compute_alpha
from krippendorff_alpha.schema import ColumnMapping
# Load your data
df = pd.read_csv("your_data.tsv", sep="\t")
# Define column mapping
column_mapping = ColumnMapping(
text_col="text",
annotator_cols=["annotator1", "annotator2", "annotator3"]
)
# Compute Krippendorff's alpha
results = compute_alpha(
df=df,
data_type="nominal",
column_mapping=column_mapping
)
print(f"Alpha: {results['alpha']}")
Limitations
- Krippendorff's alpha is more meaningful for larger data samples, however low agreement can still be a sign of labeling issue.
- The code requires at least three annotator columns to compute inter-annotator agreement.
- The function computes Krippendorff's alpha but does not provide statistical significance (e.g., confidence intervals).
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
Contributions are welcome! See the Contributing.md
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file krippendorff_aleph_alpha-0.1.17.tar.gz.
File metadata
- Download URL: krippendorff_aleph_alpha-0.1.17.tar.gz
- Upload date:
- Size: 12.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed5c5b7af7d49dc87e9a1ad2f9da47bf1274efa6e43eb0f0e8f06c0ddbff25cc
|
|
| MD5 |
e0b027653eed303d42001fb187de1936
|
|
| BLAKE2b-256 |
45216b39fbe1de3eb5f5ceabf8c967d5dc2b3a1d389b8a67041a4d0d0561f10c
|
Provenance
The following attestation bundles were made for krippendorff_aleph_alpha-0.1.17.tar.gz:
Publisher:
publish.yml on Aleph-Alpha/krippendorff-aleph-alpha
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
krippendorff_aleph_alpha-0.1.17.tar.gz -
Subject digest:
ed5c5b7af7d49dc87e9a1ad2f9da47bf1274efa6e43eb0f0e8f06c0ddbff25cc - Sigstore transparency entry: 733364678
- Sigstore integration time:
-
Permalink:
Aleph-Alpha/krippendorff-aleph-alpha@05911e8813529555388d09f935c9392a1a623fb7 -
Branch / Tag:
refs/tags/v0.1.17 - Owner: https://github.com/Aleph-Alpha
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@05911e8813529555388d09f935c9392a1a623fb7 -
Trigger Event:
release
-
Statement type:
File details
Details for the file krippendorff_aleph_alpha-0.1.17-py3-none-any.whl.
File metadata
- Download URL: krippendorff_aleph_alpha-0.1.17-py3-none-any.whl
- Upload date:
- Size: 16.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68590f0cba09df10c27e0df481e0f3acd872336064be2f89a738fa39d1f1d4d6
|
|
| MD5 |
61d1c3171e962df22afca9714a084637
|
|
| BLAKE2b-256 |
5dffc2d27562a731323139da4d3c837daa358219042e7df677da133509587434
|
Provenance
The following attestation bundles were made for krippendorff_aleph_alpha-0.1.17-py3-none-any.whl:
Publisher:
publish.yml on Aleph-Alpha/krippendorff-aleph-alpha
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
krippendorff_aleph_alpha-0.1.17-py3-none-any.whl -
Subject digest:
68590f0cba09df10c27e0df481e0f3acd872336064be2f89a738fa39d1f1d4d6 - Sigstore transparency entry: 733364710
- Sigstore integration time:
-
Permalink:
Aleph-Alpha/krippendorff-aleph-alpha@05911e8813529555388d09f935c9392a1a623fb7 -
Branch / Tag:
refs/tags/v0.1.17 - Owner: https://github.com/Aleph-Alpha
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@05911e8813529555388d09f935c9392a1a623fb7 -
Trigger Event:
release
-
Statement type: