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
Release files for indomee 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| indomee-0.1.5.tar.gz | 67.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| indomee-0.1.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 72.6 kB
Release files / indomee-0.1.5.tar.gz
| Download URL | indomee-0.1.5.tar.gz |
|---|---|
| Size | 67.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
14482bd3b7b98a1f18848525875be4272770ac9282ef4175a1a15c7f058e1bf7
|
|
BLAKE2b-256 checksum How to use checksums |
f5e96a88eea7701d219b9091f5b641d3417faeb2d5cc4e045431bb4642857a6e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.11
|
Release files / indomee-0.1.5-py3-none-any.whl
| Download URL | indomee-0.1.5-py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bb4703b3743318da76e2db0c17e3f15e1d1af09b04c0a56117dd99b957f6a6c8
|
|
BLAKE2b-256 checksum How to use checksums |
15934b50f7adf20660178d2e568b7e3a330568da4b68f2711e137a15e9c5e956
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.11
|