Skip to main content

Reference free metrics for taxonomy evaluation

Project description

Reference-Free Evaluation of Taxonomies

PyPI Tests Lint Type Check

Reference-free (and gold-standard) metrics for evaluating taxonomies — quantify how coherent, semantically adequate, and structurally sound a taxonomy is, with or without a ground-truth reference.

The metrics implemented here are described in our paper, Reference-Free Evaluation of Taxonomies (Findings of ACL 2026) — see Citation below.

Installation

Requires Python >=3.10, <=3.11. Install from PyPI:

pip install reference_free_taxonomy_eval

Or install from source:

git clone git@github.com:wullli/reference-free-taxonomy-eval.git
cd reference-free-taxonomy-eval
pip install -r requirements.txt
pip install -e .

Optional, if you have an NVIDIA GPU and want the accelerated networkx backend used by some metrics:

pip install -r requirements.gpu.txt

The NLI-based metric (NLIVerificationMetric, see below) needs a spaCy model:

python -m spacy download en_core_web_sm

Quick start

Everything starts with a Taxonomy: a thin wrapper around a networkx.DiGraph built from (parent, child) relations plus a mapping from node ids to display names.

from taxonomy_metrics.graph.taxonomy import Taxonomy

relations = [
    ("food", "fruit"),
    ("food", "vegetable"),
    ("fruit", "apple"),
    ("fruit", "pear"),
    ("vegetable", "carrot"),
]
names = {n: n for n in {p for p, _ in relations} | {c for _, c in relations}}

tax = Taxonomy(relations, id_to_name=names)

print(tax.leaves())               # ['apple', 'pear', 'carrot']
print(tax.depth())                # 3
print(tax.node_ancestry("apple")) # ['apple', 'fruit', 'food']

Running the reference-free metrics

Reference-free metrics score a taxonomy without needing a gold-standard taxonomy to compare against. They live in taxonomy_metrics.evaluation.reference_free and all share the same interface: metric.calculate(taxonomy, node_subset=None).

from sentence_transformers import SentenceTransformer

from taxonomy_metrics.graph.taxonomy import Taxonomy
from taxonomy_metrics.evaluation.reference_free.robustness import ConceptSimilarityCorrelationMetric, SemanticProximityMetric
from taxonomy_metrics.evaluation.reference_free.adequacy import NLIVerificationMetric

relations = [
    ("food", "fruit"),
    ("fruit", "apple"),
    ("fruit", "pear"),
    ("fruit", "stone fruit"),
    ("stone fruit", "peach"),
    ("stone fruit", "apricot"),
    ("food", "spice"),
    ("spice", "cinnamon"),
    ("spice", "pepper"),
    ("food", "vegetable"),
    ("vegetable", "carrot"),
    ("vegetable", "broccoli"),
]
names = {n: n for n in {p for p, _ in relations} | {c for _, c in relations}}
tax = Taxonomy(relations, id_to_name=names)

model = SentenceTransformer("sentence-transformers/all-MiniLM-L6-v2")

csc = ConceptSimilarityCorrelationMetric(sentence_transformer=model)
sp = SemanticProximityMetric(sentence_transformer=model)
nli = NLIVerificationMetric()  # defaults to facebook/bart-large-mnli + en_core_web_sm

print(csc.calculate(tax))  # {'ConceptSimilarityCorrelation': ...}
print(sp.calculate(tax))   # {'SemanticProximity': 0.83...}
print(nli.calculate(tax))  # {'NLIVerification-Strong': ..., 'NLIVerification-Weak': ...}

Citation

If you use this package, please cite:

Pascal Wullschleger, Majid Zarharan, Donnacha Daly, Marc Pouly, and Jennifer Foster. 2026. Reference-Free Evaluation of Taxonomies. In Findings of the Association for Computational Linguistics: ACL 2026, pages 25489–25507, San Diego, California, United States. Association for Computational Linguistics.

@inproceedings{wullschleger-etal-2026-reference,
    title = "Reference-Free Evaluation of Taxonomies",
    author = "Wullschleger, Pascal  and
      Zarharan, Majid  and
      Daly, Donnacha  and
      Pouly, Marc  and
      Foster, Jennifer",
    editor = "Liakata, Maria  and
      Moreira, Viviane P.  and
      Zhang, Jiajun  and
      Jurgens, David",
    booktitle = "Findings of the {A}ssociation for {C}omputational {L}inguistics: {ACL} 2026",
    month = jul,
    year = "2026",
    address = "San Diego, California, United States",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2026.findings-acl.1273/",
    doi = "10.18653/v1/2026.findings-acl.1273",
    pages = "25489--25507",
    ISBN = "979-8-89176-395-1",
}

License

MIT — see LICENSE.

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

reference_free_taxonomy_eval-0.1.2.tar.gz (31.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

reference_free_taxonomy_eval-0.1.2-py3-none-any.whl (48.6 kB view details)

Uploaded Python 3

File details

Details for the file reference_free_taxonomy_eval-0.1.2.tar.gz.

File metadata

File hashes

Hashes for reference_free_taxonomy_eval-0.1.2.tar.gz
Algorithm Hash digest
SHA256 add5784fc8ceeb008dbf3ea3edc9d72b8df9245f2bbe339afdafdb213e6a8150
MD5 297b5bfbe61c225252d3f3a773d63253
BLAKE2b-256 2e618f6b43fb7d09b6667bba04355077e8df90dc29e3d6d0f50bdbe02dc0755f

See more details on using hashes here.

File details

Details for the file reference_free_taxonomy_eval-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for reference_free_taxonomy_eval-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b0f0fe63c1ab009641eb1ec7496c117befb3e88305f7d49bd635ae4087141611
MD5 a2536f48d7c2bcc0a29c9f5d0016f10e
BLAKE2b-256 1e20f0af231224c5ef0cfd79232fd8e613a65f6379767eb2f8c43b71b92b882c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page