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.3.tar.gz (65.9 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.3-py3-none-any.whl (20.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyena-0.1.3.tar.gz
  • Upload date:
  • Size: 65.9 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.3.tar.gz
Algorithm Hash digest
SHA256 e27bed35e082c1b03c0d82de8d57d7e9cf60470ff7f4ad265fcd0075e0a66b38
MD5 f9d7b815c13109b600a9c075e93c4bf9
BLAKE2b-256 fe5e2d43047964c553ad81c2a9483fa71b09bc74dd8d93c968ebcaaa24c4b68c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyena-0.1.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4c6345c635786a51130047b32689602cfba494b05c525aa7dc3ff2ecfb66f697
MD5 7edb052ffc44c1a5e037a4f30baa6d7d
BLAKE2b-256 a2721223d5b466493bbf9872807e32fca6d631f84707e0b27c92633416c96720

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