Python implementation of Epistemic Network Analysis, verified against rENA
Project description
pyena
pyena is a Python implementation of Epistemic Network Analysis (ENA),
numerically verified against the reference R package
rENA 0.3.1.
Features
- Verified adjacency vectors — reverse-engineered from rENA's C++ source
(
vector_to_ut+ref_window_df), using the cross-speaker moving stanza window. Verified exactly against rENA on nine datasets (RS.data + eight synthetic). - SVD projection + means rotation — both stages match rENA outputs at machine epsilon on RS.data (RMSE < 1e-16).
- Group comparison — Welch's t, Mann-Whitney U, and permutation test in one call, with automatic small-sample diagnostics.
- Reproducibility metrics — four indicators (centroid dispersion, pairwise distance, 95% confidence ellipse area, convex hull area) for quantifying the spread of repeated analyses under nominally identical conditions.
- scikit-learn-style API — single
ENAestimator that orchestrates the full pipeline.
Installation
pip install pyena
Requires Python 3.10+.
Development install
git clone https://github.com/zhegllyang/pyena.git
cd pyena
pip install -e ".[dev]"
Quickstart
import pandas as pd
from pyena import ENA
df = pd.read_csv("your_long_format_utterances.csv")
ena = ENA(
codes=["Data", "Theory", "Question", "Example", "Critique"],
unit_col="unit",
conversation_col="conversation",
window_size=4,
rotation="means",
mr_groups=("A", "B"),
)
ena.fit(df)
ena.plot()
result = ena.compare(axis="x")
metrics = ena.reproducibility()
Validation against rENA 0.3.1
| Stage | Test data | Match | Max abs diff |
|---|---|---|---|
| Adjacency vectors | nine datasets (RS.data + 8 synthetic) | all cells | 0 |
| SVD coordinates | RS.data (48 units × 2 axes) | 96 / 96 | < 1e-15 |
| Means rotation | RS.data (48 units × 2 axes) | 96 / 96 | < 1e-15 |
| Node placement | RS.data (6 codes × 2 axes) | 12 / 12 | < 1e-13 |
See tests/test_adjacency.py, tests/test_projection.py, and
tests/test_crossspeaker.py for the regression tests, and the R scripts in
validation_rsdata/ for regenerating the rENA reference outputs.
Testing
pytest
108 tests cover reference regression, mathematical properties of each algorithm, and external cross-checks against scipy (Welch, Mann-Whitney) and the rENA reference outputs.
Citation
If you use pyena in your research, please cite:
@software{song_pyena_2026,
author = {Song, JongHwi},
title = {{pyena: Python implementation of Epistemic Network Analysis, verified against rENA}},
year = {2026},
publisher = {Zenodo},
version = {0.2.0},
doi = {10.5281/zenodo.20339527},
url = {https://github.com/zhegllyang/pyena}
}
A SoftwareX paper describing pyena is in preparation.
License
BSD 3-Clause. See LICENSE.
Acknowledgements
pyena reimplements the algorithms of rENA 0.3.1 by Marquart, Swiecki, Collier, Eagan, Woodward, and Shaffer. The reimplementation was done independently from the publicly available C++ and R source code.
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
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 pyena-0.2.0.tar.gz.
File metadata
- Download URL: pyena-0.2.0.tar.gz
- Upload date:
- Size: 209.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
45a5ddfbe19295e481b16a78725a264dcc47a101182b3092de1a412b1d2d4d09
|
|
| MD5 |
4d09bd2b3cfaf43b51887162a2b9655a
|
|
| BLAKE2b-256 |
718bc755a88029be3f7b74f8e845e0b33c7fa3d2ba592f475b25ed432e2c1df0
|
File details
Details for the file pyena-0.2.0-py3-none-any.whl.
File metadata
- Download URL: pyena-0.2.0-py3-none-any.whl
- Upload date:
- Size: 23.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6179423696549bd0bc10fa3bdbcadd168cc2d6f0f846807df5a358dcfa703ce
|
|
| MD5 |
a2de7e314fff08537820df7cdb094402
|
|
| BLAKE2b-256 |
271f86c6b78c75fa4f965aa4f26aa80403b8b3c38b9e574589917ef2c5bc1b41
|