File size: 685 Bytes
f343f06
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Evaluation Module

Metrics and ground truth management for retrieval evaluation.

## Files

| File | Description |
|------|-------------|
| `metrics.py` | F1@K, precision, recall, timing statistics |
| `ground_truth.py` | Ground truth label management |

## Metrics

| Metric | Description |
|--------|-------------|
| F1@5 | Precision@5 x Recall@5 |
| F1@10 | Precision@10 x Recall@10 |
| Same-Modal F1 | F1 for same-modality queries |
| Cross-Modal F1 | F1 for cross-modality queries |

## Usage

```python
from src.evaluation.metrics import compute_f1

# Compute F1@K
f1_score = compute_f1(
    predicted_indices=result.indices,
    ground_truth_indices=gt_indices,
    k=5
)
```