This project has been archived by its maintainers, and is no longer receiving any updates.
Evaluation
pip install discophon.evaluate
This package provides low-level functions to evaluate your model's predictions on phoneme discovery.
Phoneme discovery
You can use the phoneme_discovery function with units: dict[str, list[int]], and phones: dict[str, list[str]].
You also need to set the number of units n_units, of phonemes n_phones, and the step (in ms) between consecutive
units step_units.
Example:
from discophon.core import read_gold_annotations, read_submitted_units
from discophon.evaluate import phoneme_discovery
phones = read_gold_annotations("/path/to/alignments/dataset.align")
units = read_submitted_units("/path/to/predictions/units.jsonl")
result = phoneme_discovery(units, phones, n_units=256, n_phones=40, step_units=20)
print(result)
Or via the CLI:
❯ python -m discophon.evaluate --help
usage: discophon.evaluate [-h] [--n-units N_UNITS] [--n-phones N_PHONES] [--step-units STEP_UNITS] units phones
Evaluate predicted units on phoneme discovery
positional arguments:
units path to predicted units
phones path to gold alignments
options:
-h, --help show this help message and exit
--n-units N_UNITS number of units
--n-phones N_PHONES number of phonemes
--step-units STEP_UNITS
step between units (in ms)
ABX
The ABX evaluation is done separately. First, install this package with the abx optional dependency group:
pip install discophon.evaluate[abx]
Then, either run it in Python:
from discophon.evaluate.abx import discrete_abx, continuous_abx
result_discrete = discrete_abx("/path/to/item/dataset.item", "/path/to/predictions/units.jsonl", frequency=50)
print("Discrete: ", result_discrete)
result_continuous = continuous_abx("/path/to/item/dataset.item", "/path/to/features", frequency=50)
print("Continuous: ", result_discrete)
Or via the CLI:
❯ python -m discophon.evaluate.abx --help
usage: discophon.evaluate.abx [-h] --frequency FREQUENCY item root
Continuous or discrete ABX
positional arguments:
item Path to the item file
root Path to the JSONL with units or directory with continuous features
options:
-h, --help show this help message and exit
--frequency FREQUENCY
Units frequency in Hz
Metadata
Release files for discophon.evaluate 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| discophon_evaluate-0.0.2.tar.gz | 8.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| discophon_evaluate-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.9 kB
Release files / discophon_evaluate-0.0.2.tar.gz
| Download URL | discophon_evaluate-0.0.2.tar.gz |
|---|---|
| Size | 8.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a4aa79e75e4416c62924ec92ba836ee5af96bac55c21ca20941bad796ec7f39c
|
|
BLAKE2b-256 checksum How to use checksums |
d1ed58c85522168edb53f4e26883b3001381f53c53b984ff4e3a8f1756ec2d71
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.9.14 {"installer":{"name":"uv","version":"0.9.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / discophon_evaluate-0.0.2-py3-none-any.whl
| Download URL | discophon_evaluate-0.0.2-py3-none-any.whl |
|---|---|
| Size | 10.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4d553c0a7353acaf8d347d302fcd8bb436ebc8f3654668c5c37632f2ea6fc95f
|
|
BLAKE2b-256 checksum How to use checksums |
ce02d3c2782d4b3634e8080aa3c15257276d522698a81cfbce103ef9a7d1f8ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.9.14 {"installer":{"name":"uv","version":"0.9.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|