Emergent Language Analysis Toolkit
Project description
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, 3.12.
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) - Harris' Articulation Scheme [6] (
emlangkit.metrics.has) - Non-Compositional Normalised Pointwise Mutual Information (NPMI) [7]
(
emlangkit.metrics.nc_npmi)
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!
- EGG - https://github.com/facebookresearch/EGG
- Harris' Articulation Scheme - https://github.com/wedddy0707/HarrisSegmentation
- CGI - https://github.com/wedddy0707/categorial_grammar_induction_of_emergent_language
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
- [7] O. Lipinski, A. J. Sobey, F. Cerutti, and T. J. Norman, ‘Speaking Your Language: Spatial Relationships in Interpretable Emergent Communication’, NeurIPS 2024
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file emlangkit-0.3.0.tar.gz.
File metadata
- Download URL: emlangkit-0.3.0.tar.gz
- Upload date:
- Size: 18.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4be4b05d735dbf3364eef87d0e5db6bcf966d4aa60c9044773f887cdd5ef1e41
|
|
| MD5 |
f7b0b71f628c6a385025e071bd8a5f9a
|
|
| BLAKE2b-256 |
012a371278ff3e1f894430695f6806ffa50f662d3792491d95185fe3c54833ee
|
Provenance
The following attestation bundles were made for emlangkit-0.3.0.tar.gz:
Publisher:
release-pypi.yml on olipinski/emlangkit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
emlangkit-0.3.0.tar.gz -
Subject digest:
4be4b05d735dbf3364eef87d0e5db6bcf966d4aa60c9044773f887cdd5ef1e41 - Sigstore transparency entry: 167331265
- Sigstore integration time:
-
Permalink:
olipinski/emlangkit@f34adae367f9f29e1de8d11f2172a9696c14e4c6 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/olipinski
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yml@f34adae367f9f29e1de8d11f2172a9696c14e4c6 -
Trigger Event:
release
-
Statement type:
File details
Details for the file emlangkit-0.3.0-py3-none-any.whl.
File metadata
- Download URL: emlangkit-0.3.0-py3-none-any.whl
- Upload date:
- Size: 18.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d9545f7737d9b428c427221c30d449f9d0a5f45c5b6390ab062e0b0b8fc7c7d
|
|
| MD5 |
4c8447671750a05d4d5eb68890b151a2
|
|
| BLAKE2b-256 |
05445c129b478c9d27eef38c5f2f282a79c395a9bfb2ca537d408fd31ced0bdb
|
Provenance
The following attestation bundles were made for emlangkit-0.3.0-py3-none-any.whl:
Publisher:
release-pypi.yml on olipinski/emlangkit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
emlangkit-0.3.0-py3-none-any.whl -
Subject digest:
8d9545f7737d9b428c427221c30d449f9d0a5f45c5b6390ab062e0b0b8fc7c7d - Sigstore transparency entry: 167331267
- Sigstore integration time:
-
Permalink:
olipinski/emlangkit@f34adae367f9f29e1de8d11f2172a9696c14e4c6 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/olipinski
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yml@f34adae367f9f29e1de8d11f2172a9696c14e4c6 -
Trigger Event:
release
-
Statement type: