Skip to main content

pyena

PyPI License: BSD-3-Clause Python Tests DOI

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 ENA estimator 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.

Metadata

Release files for pyena 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyena 0.2.0
File Size Uploaded Provenance Actions
pyena-0.2.0.tar.gz 209.1 kB Without provenance Details for pyena-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyena 0.2.0
File Interpreter ABI Platform Actions
pyena-0.2.0-py3-none-any.whl Python 3 none any Details for pyena-0.2.0-py3-none-any.whl

Total release size: 233.0 kB

Release files / pyena-0.2.0.tar.gz

Download URL pyena-0.2.0.tar.gz
Size 209.1 kB
Tags Source
SHA-256 checksum
How to use checksums
45a5ddfbe19295e481b16a78725a264dcc47a101182b3092de1a412b1d2d4d09
BLAKE2b-256 checksum
How to use checksums
718bc755a88029be3f7b74f8e845e0b33c7fa3d2ba592f475b25ed432e2c1df0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release files / pyena-0.2.0-py3-none-any.whl

Download URL pyena-0.2.0-py3-none-any.whl
Size 23.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b6179423696549bd0bc10fa3bdbcadd168cc2d6f0f846807df5a358dcfa703ce
BLAKE2b-256 checksum
How to use checksums
271f86c6b78c75fa4f965aa4f26aa80403b8b3c38b9e574589917ef2c5bc1b41
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Security for pyena 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page