Skip to main content

Emergent Language Analysis Toolkit

Project description

pre-commit Code style: black

Emergent Language Analysis Toolkit

This toolkit aims to collect all metrics currently used in emergent communication research into one place. The usage should be convenient and the inputs should be standardised, to ease adoption and spread of these metrics.

Installation

To install emlangkit, run pip install emlangkit.

Automatic tests are run for Python 3.9, 3.10, 3.11.

Usage

All metrics are available through the Language class in emlangkit.Language. This class accepts two numpy arrays as inputs - messages and observations. These are then used, with some possible speedups, to calculate any requested metric, as per example below

import numpy as np
from emlangkit import Language

messages = np.array(
    [[1, 2, 0, 3, 4], [1, 2, 2, 3, 4], [1, 2, 2, 3, 0], [1, 0, 0, 1, 2]]
)
observations = np.array([[4, 4], [4, 3], [3, 2], [1, 4]])

lang = Language(messages=messages, observations=observations)

score, p_value = lang.topsim()

# Mutual information already requires both language and observation entropy
mi = lang.mutual_information()

# So this call uses less computation
lang_entropy = lang.language_entropy()

Metrics

Currently available metrics, with their implementations as per below.

  • Entropy [1,2] (emlangkit.metrics.entropy)
  • Mutual Information [1,2] (emlangkit.metrics.mutual_information)
  • Topographic Similarity [1,2,3] (emlangkit.metrics.topsim)
  • Positional Disentanglement [2,4] (emlangkit.metrics.posdis)
  • Bag-of-Words Disentanglement [2,4] (emlangkit.metrics.bosdis)
  • M_previous^n [5] (emlangkit.metrics.mpn)

Contributing

All pull requests are welcome! Just please make sure to install pre-commit and run the pytests before submitting a PR. Additionally, if a lot of new code is added, please also add the relevant tests.

Related Libraries

This is a non-exhaustive list of libraries related to EC research. Please feel free to open a PR to add to it!

Citation

If you find emlangkit useful in your work, please cite it as below:

@software{lipinski_emlangkit_2023,
        title = {emlangkit: Emergent Language Analysis Toolkit},
        url = {https://github.com/olipinski/emlangkit},
        author = {Lipinski, Olaf},
        year = {2023}
}

Sources

Most of the base metrics are inspired or taken from either EGG, or code from the paper "Catalytic Role Of Noise And Necessity Of Inductive Biases In The Emergence Of Compositional Communication" here.

Citations for the metrics and parts of this software:

  • [1] L. Kucinski, T. Korbak, P. Kolodziej, and P. Milos, ‘Catalytic Role Of Noise And Necessity Of Inductive Biases In The Emergence Of Compositional Communication’, NeurIPS 2021
  • [2] E. Kharitonov, R. Chaabouni, D. Bouchacourt, and M. Baroni, ‘EGG: a toolkit for research on Emergence of lanGuage in Games’, EMNLP-IJCNLP 2019
  • [3] H. Brighton and S. Kirby, ‘Understanding Linguistic Evolution by Visualizing the Emergence of Topographic Mappings’, Artificial Life, vol. 12, no. 2, pp. 229–242, Apr. 2006
  • [4] R. Chaabouni, E. Kharitonov, D. Bouchacourt, E. Dupoux, and M. Baroni, ‘Compositionality and Generalization In Emergent Languages’, ACL 2020
  • [5] O. Lipinski, A. J. Sobey, F. Cerutti, and T. J. Norman, ‘On Temporal References in Emergent Communication’. arXiv.2310.06555
  • [6] R. Ueda, T. Ishii, and Y. Miyao, ‘On the Word Boundaries of Emergent Languages Based on Harris’s Articulation Scheme’, ICLR 2023

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

emlangkit-0.2.0.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

emlangkit-0.2.0-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

Details for the file emlangkit-0.2.0.tar.gz.

File metadata

  • Download URL: emlangkit-0.2.0.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for emlangkit-0.2.0.tar.gz
Algorithm Hash digest
SHA256 8bb9f9aba491a58bb968f8376278449b034bb7b7bbf1cd3bca0afd2ce663310d
MD5 5e03c8dbcbc258f4e8ca737511f63ef1
BLAKE2b-256 f852749be5045908c8924b7fa5cd9ace9c21d2b7fc528208dce506b5814a1880

See more details on using hashes here.

File details

Details for the file emlangkit-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: emlangkit-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 16.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for emlangkit-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eec49f6862b4a41a167304241c1cbe4319bdddd5dca27e1be83fe487618b05cd
MD5 ba88d0a966ffb29bfa9aa41215fd2322
BLAKE2b-256 465fd5619745f795ea08dea9b6530bb765a626485af81e4d2ceba28f3cae8108

See more details on using hashes here.

Supported by

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