Python package for evaluation of retrieval-augmented generation (RAG) models
Project description
Indomee
Indomee is a Python package designed to simplify the evaluation of retrieval-augmented generation (RAG) models and other retrieval-based systems. With indomee, you can compute common evaluation metrics like recall and mean reciprocal rank (MRR) at various levels of k, all through a straightforward API.
We also provide support for simple bootstrapping at the moment with t-testing coming soon.
Installation
pip install indomee
You can get started with indomee with the following example
Indomee provides functions to calculate various metrics such as Mean Reciprocal Rank (MRR) and Recall.
Example Usage
from indomee import calculate_mrr, calculate_recall, calculate_metrics_at_k
mrr = calculate_mrr([1, 2, 3], [2, 3, 4])
print("MRR:", mrr)
# > MRR: 0.5
# Calculate Recall
recall = calculate_recall([1, 2, 3], [2])
print("Recall:", recall)
# > Recall: 1
# Calculate metrics at specific k values
metrics = calculate_metrics_at_k(
metrics=["recall"], preds=[1, 2, 3], labels=[2], k=[1, 2, 3]
)
print("Metrics at k:", metrics)
# > {'recall@1': 0.0, 'recall@2': 1.0, 'recall@3': 1.0}
2. Bootstrapping
Indomee also supports bootstrapping for more robust metric evaluation.
Example Usage
from indomee import bootstrap_sample, bootstrap
# Bootstrapping a sample
result = bootstrap_sample(preds=[["a", "b"], ["c", "d"], ["e", "f"]], labels=[["a", "b"], ["c", "d"], ["e", "f"]], n_samples=10, metrics=["recall"], k=[1, 2, 3])
print("Bootstrap Sample Metrics:", result.sample_metrics)
# Bootstrapping multiple samples
result = bootstrap(preds=[["a", "b"], ["c", "d"], ["e", "f"]], labels=[["a", "b"], ["c", "d"], ["e", "f"]], n_samples=10, n_iterations=10, metrics=["recall"], k=[1, 2, 3])
print("Bootstrap Metrics:", result.sample_metrics)
3. T-Testing
For the last portion, we'll show how to perform a t-test between two different results that we've obtained from the different methods.
from indomee import perform_t_tests
import pandas as pd
df = pd.read_csv("./data.csv")
# Calculate the mean for each method
method_1 = df["method_1"].tolist()
method_2 = df["method_2"].tolist()
baseline = df["baseline"].tolist()
results = perform_t_tests(
baseline, method_1, method_2,
names=["Baseline", "Method 1", "Method 2"],
paired=True,
)
results
Project details
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 indomee-0.1.3.tar.gz.
File metadata
- Download URL: indomee-0.1.3.tar.gz
- Upload date:
- Size: 64.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
41bf0406c0df66780b31321c5aa4e931422420f67b9ac81fcad31ef31b44e63d
|
|
| MD5 |
853ace38a457007eeabfed443c2ee328
|
|
| BLAKE2b-256 |
7b1a35e26c09e770df41f3b1ab7d754432127d8d3a336693b52d30c98e7098eb
|
Provenance
The following attestation bundles were made for indomee-0.1.3.tar.gz:
Publisher:
release.yml on ivanleomk/indomee
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
indomee-0.1.3.tar.gz -
Subject digest:
41bf0406c0df66780b31321c5aa4e931422420f67b9ac81fcad31ef31b44e63d - Sigstore transparency entry: 153188188
- Sigstore integration time:
-
Permalink:
ivanleomk/indomee@6cc551c1995a82952394e74c183a4746c2ad5f21 -
Branch / Tag:
refs/tags/0.1.3 - Owner: https://github.com/ivanleomk
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@6cc551c1995a82952394e74c183a4746c2ad5f21 -
Trigger Event:
release
-
Statement type:
File details
Details for the file indomee-0.1.3-py3-none-any.whl.
File metadata
- Download URL: indomee-0.1.3-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f470cb39353f010af4d6c13bdbd68017de55930a8a054341935d18d2d8d4887
|
|
| MD5 |
0b8132b02998e652d3b4a3f787f58d37
|
|
| BLAKE2b-256 |
61e781c71bcee91eb9d84e240bf73441d46fec8a483096736b2d0b4d47ba063c
|
Provenance
The following attestation bundles were made for indomee-0.1.3-py3-none-any.whl:
Publisher:
release.yml on ivanleomk/indomee
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
indomee-0.1.3-py3-none-any.whl -
Subject digest:
0f470cb39353f010af4d6c13bdbd68017de55930a8a054341935d18d2d8d4887 - Sigstore transparency entry: 153188189
- Sigstore integration time:
-
Permalink:
ivanleomk/indomee@6cc551c1995a82952394e74c183a4746c2ad5f21 -
Branch / Tag:
refs/tags/0.1.3 - Owner: https://github.com/ivanleomk
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@6cc551c1995a82952394e74c183a4746c2ad5f21 -
Trigger Event:
release
-
Statement type: