Skip to main content

Python implementation of rENA-exact Epistemic Network Analysis

Project description

pyena

PyPI License: BSD-3-Clause Python Tests DOI

pyena is a Python implementation of rENA-exact Epistemic Network Analysis (ENA), numerically validated bit-for-bit against the reference R package rENA 0.3.1.

Features

  • rENA-exact adjacency vectors — reverse-engineered from rENA's C++ source (vector_to_ut + ref_window_df). Verified at 900/900 cells, max abs diff = 0.
  • SVD projection + means rotation — both stages match rENA outputs at machine epsilon (180/180 values each).
  • 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) designed for LLM dialogue-path analysis.
  • 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 90 units × 1800 utterances × 5 codes 900 / 900 0
SVD coordinates same 180 / 180 0
Means rotation same 180 / 180 < 4e-16

See tests/test_adjacency.py, tests/test_projection.py for the regression tests, and notebooks/02_rena_comparison.ipynb for the original validation workflow against rENA via rpy2.

Testing

pytest

101 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 rENA-exact Epistemic Network Analysis}},
  year      = {2026},
  publisher = {Zenodo},
  version   = {0.1.2},
  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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyena-0.1.2.tar.gz (65.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyena-0.1.2-py3-none-any.whl (20.2 kB view details)

Uploaded Python 3

File details

Details for the file pyena-0.1.2.tar.gz.

File metadata

  • Download URL: pyena-0.1.2.tar.gz
  • Upload date:
  • Size: 65.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for pyena-0.1.2.tar.gz
Algorithm Hash digest
SHA256 6aa6a5e7693824987c418fdbf0ffb73298b01058d83f4e8fae3604b5fbfa6dd4
MD5 63b120e00459e7cf075b990a52907aec
BLAKE2b-256 987f6fcdb7766806b6f8e76e042082251e12ee78726031d977a816f9c878328c

See more details on using hashes here.

File details

Details for the file pyena-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: pyena-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 20.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for pyena-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f38593166bdd4dd40db046c9d4a1e95ed0b757abaf57471f08711ae4bb6ade17
MD5 f36a5af67db84517b955e40a7fa60332
BLAKE2b-256 43950c4ef88af2bc93eaf1d5830e0bbbfb621bd0568eda4b27b02188cda7a629

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page