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.
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 (
emlangkit.metrics.entropy
) - Mutual Information (
emlangkit.metrics.mutual_information
) - Topographic Similarity (
emlangkit.metrics.topsim
) - Positional Disentanglement (
emlangkit.metrics.posdis
) - Bag-of-Words Disentanglement (
emlangkit.metrics.bosdis
)
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
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.
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}
}
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file emlangkit-0.0.1.tar.gz
.
File metadata
- Download URL: emlangkit-0.0.1.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6df5562287f12de84d5b5fc551a17a62f9970138fb9403461d58b1fda877cfbd |
|
MD5 | 2ef793ef7682d95f9be1fa07b0e1e9fb |
|
BLAKE2b-256 | d581c59bf641054b38b50bbc456afbb6e02cc7e79b267b0be64eda8dd0ffdcaa |
File details
Details for the file emlangkit-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: emlangkit-0.0.1-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a20fa730067ea6865b18bc9992e312d5e9d12cdb49475e3d24d7ece8dabf912b |
|
MD5 | 6de955b534b0219e6a8bd36da3cb6153 |
|
BLAKE2b-256 | 1d9be21202772a6a6b6c4a5346bff0d63b4bef187cfa4fa9761e97e33e6e21aa |