Skip to content
Back to skills

Chrf Bleu Geometric Mean Metric

ASecurity

Geometric mean of chrF and BLEU as a balanced composite translation evaluation metric

  • 61 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 12, 2026
developmentpythongo

Security analysis

A100/100

Scanned September 12, 2026

npx -y skills add wenmin-wu/ds-skills --skill chrf-bleu-geometric-mean-metric --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Chrf Bleu Geometric Mean Metric?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Chrf Bleu Geometric Mean Metric
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/wenmin-wu-chrf-bleu-geometric-mean-metric/badge)](https://www.skillsdirectory.com/skills/wenmin-wu-chrf-bleu-geometric-mean-metric)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: nlp-chrf-bleu-geometric-mean-metric
description: Geometric mean of chrF and BLEU as a balanced composite translation evaluation metric
domain: nlp
---

# chrF-BLEU Geometric Mean Metric

## Overview

chrF captures character-level quality (good for morphology), BLEU captures word-level n-gram precision. Their geometric mean balances both aspects and is more robust than either alone as a model selection metric during training.

## Quick Start

```python
import sacrebleu
import numpy as np

def chrf_bleu_geomean(predictions, references):
    chrf = sacrebleu.corpus_chrf(predictions, [references], word_order=2)
    bleu = sacrebleu.corpus_bleu(predictions, [references])
    c, b = chrf.score, bleu.score
    geo = (c * b) ** 0.5 if c > 0 and b > 0 else 0.0
    return {"chrf": c, "bleu": b, "geo_mean": geo}

# HuggingFace Trainer integration
def compute_metrics(eval_preds):
    preds, labels = eval_preds
    preds = np.where(preds == -100, tokenizer.pad_token_id, preds)
    labels = np.where(labels == -100, tokenizer.pad_token_id, labels)
    decoded_preds = tokenizer.batch_decode(preds, skip_special_tokens=True)
    decoded_labels = tokenizer.batch_decode(labels, skip_special_tokens=True)
    return chrf_bleu_geomean(decoded_preds, decoded_labels)
```

## Key Decisions

- **Geometric not arithmetic mean**: penalizes if either metric is very low
- **chrF++ (word_order=2)**: includes word bigrams, more discriminative than plain chrF
- **Use for model selection**: pick checkpoint with best geo_mean on validation set

## References

- Source: [dpc-starter-train](https://www.kaggle.com/code/takamichitoda/dpc-starter-train)
- Competition: Deep Past Challenge - Translate Akkadian to English

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.