Skip to main content

Native Python package for high-dimensional undirected graph estimation

Project description

pyhuge Python Package

pyhuge is the native Python package for high-dimensional undirected graph estimation and inference, sharing the same C++ core as the R huge package.

Table of contents

Background

pyhuge runs natively in Python with a shared C++ backend and does not require an R runtime.

Directory structure

  • pyhuge/: package source code
  • pyhuge/data/: packaged datasets (stockdata.npz)
  • cpp/: optional pybind11 acceleration kernels
  • tests/: unit/e2e/parity tests
  • examples/: runnable scripts
  • docs/: MkDocs documentation pages
  • scripts/: release and docs helper scripts

What this package provides

  • Core estimators: huge, huge_mb, huge_glasso, huge_ct, huge_tiger
  • Model selection: huge_select (ric, stars, ebic)
  • Data transforms and utilities: huge_npn, huge_generator, huge_roc, huge_inference
  • Plotting helpers: huge_plot_sparsity, huge_plot_roc, huge_plot_graph_matrix, huge_plot_network, huge_plot
  • Dataset helper: huge_stockdata
  • Diagnostics: pyhuge.test(), pyhuge-doctor

Requirements

  • Python >=3.9
  • Runtime packages: numpy, scipy
  • Native extension: pyhuge._native_core is required for mb, tiger, glasso

Optional:

  • plotting: matplotlib, networkx
  • docs: mkdocs, mkdocs-material

Installation

From source:

cd python-package
pip install -e ".[runtime]"

Optional extras:

pip install -e ".[viz]"
pip install -e ".[test]"
pip install -e ".[docs]"
pip install -e ".[dev]"

Runtime check:

python -c "import pyhuge; print(pyhuge.test())"
pyhuge-doctor

Usage

import numpy as np
from pyhuge import huge, huge_select

rng = np.random.default_rng(1)
x = rng.normal(size=(120, 30))

fit = huge(x, method="mb", nlambda=8, verbose=False)
sel = huge_select(fit, criterion="ric", verbose=False)

print(fit.method, len(fit.path), sel.opt_lambda, sel.opt_sparsity)

Network visualization:

import matplotlib.pyplot as plt
from pyhuge import huge_plot_network

fig, ax = plt.subplots(figsize=(5, 5))
huge_plot_network(fit, index=-1, ax=ax, layout="spring")
plt.show()

Documentation

  • Docs source: python-package/docs
  • Function manual pages: python-package/docs/man

Build locally:

cd python-package
mkdocs build --strict

Developer workflow

cd python-package
pytest
bash scripts/build_dist.sh
python scripts/bump_version.py 0.8.1
bash scripts/release.sh 0.8.1

Citation

If you use huge/pyhuge in research, cite:

@article{zhao2012huge,
  title   = {The huge Package for High-dimensional Undirected Graph Estimation in R},
  author  = {Zhao, Tuo and Liu, Han and Roeder, Kathryn and Lafferty, John and Wasserman, Larry},
  journal = {Journal of Machine Learning Research},
  volume  = {13},
  pages   = {1059--1062},
  year    = {2012}
}

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

pyhuge-0.8.0.tar.gz (1.6 MB view details)

Uploaded Source

Built Distribution

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

pyhuge-0.8.0-cp314-cp314-macosx_26_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.14macOS 26.0+ ARM64

File details

Details for the file pyhuge-0.8.0.tar.gz.

File metadata

  • Download URL: pyhuge-0.8.0.tar.gz
  • Upload date:
  • Size: 1.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for pyhuge-0.8.0.tar.gz
Algorithm Hash digest
SHA256 526f334a570749c4d8205a31ad93a94b737400a34ca09018774aabf16472585d
MD5 2d51c257eb8d94a3c2be31f2c64bbe59
BLAKE2b-256 82753237a552e8719b3d4bdfa176b81416f7b56094e14be33b155b532aa3841d

See more details on using hashes here.

File details

Details for the file pyhuge-0.8.0-cp314-cp314-macosx_26_0_arm64.whl.

File metadata

File hashes

Hashes for pyhuge-0.8.0-cp314-cp314-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 5d6ed61f8eaedb1d7e6a66d0bf8be5d878afb24cd3a4c68694520e8c43269a0b
MD5 3f813611a9816dfc12f80d48e933ba72
BLAKE2b-256 b29b56754b8fae478d9c5ecdd150ee35862f0d754898e7af50b0d67ce9eb3d99

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