pyhuge 0.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. pyhuge-0.2.1/CHANGELOG.md +71 -0
  2. pyhuge-0.2.1/CONTRIBUTING.md +60 -0
  3. pyhuge-0.2.1/MANIFEST.in +10 -0
  4. pyhuge-0.2.1/PKG-INFO +252 -0
  5. pyhuge-0.2.1/README.md +210 -0
  6. pyhuge-0.2.1/docs/api.md +245 -0
  7. pyhuge-0.2.1/docs/changelog.md +9 -0
  8. pyhuge-0.2.1/docs/citation.md +18 -0
  9. pyhuge-0.2.1/docs/contributing.md +37 -0
  10. pyhuge-0.2.1/docs/design.md +36 -0
  11. pyhuge-0.2.1/docs/index.md +50 -0
  12. pyhuge-0.2.1/docs/installation.md +65 -0
  13. pyhuge-0.2.1/docs/man/huge.md +43 -0
  14. pyhuge-0.2.1/docs/man/huge_ct.md +17 -0
  15. pyhuge-0.2.1/docs/man/huge_generator.md +31 -0
  16. pyhuge-0.2.1/docs/man/huge_glasso.md +23 -0
  17. pyhuge-0.2.1/docs/man/huge_inference.md +31 -0
  18. pyhuge-0.2.1/docs/man/huge_mb.md +24 -0
  19. pyhuge-0.2.1/docs/man/huge_npn.md +20 -0
  20. pyhuge-0.2.1/docs/man/huge_plot_graph_matrix.md +17 -0
  21. pyhuge-0.2.1/docs/man/huge_plot_network.md +31 -0
  22. pyhuge-0.2.1/docs/man/huge_plot_roc.md +11 -0
  23. pyhuge-0.2.1/docs/man/huge_plot_sparsity.md +17 -0
  24. pyhuge-0.2.1/docs/man/huge_roc.md +21 -0
  25. pyhuge-0.2.1/docs/man/huge_select.md +36 -0
  26. pyhuge-0.2.1/docs/man/huge_select_summary.md +15 -0
  27. pyhuge-0.2.1/docs/man/huge_summary.md +21 -0
  28. pyhuge-0.2.1/docs/man/huge_tiger.md +18 -0
  29. pyhuge-0.2.1/docs/man/index.md +36 -0
  30. pyhuge-0.2.1/docs/man/test.md +24 -0
  31. pyhuge-0.2.1/docs/performance.md +26 -0
  32. pyhuge-0.2.1/docs/quickstart.md +111 -0
  33. pyhuge-0.2.1/docs/release.md +53 -0
  34. pyhuge-0.2.1/docs/troubleshooting.md +93 -0
  35. pyhuge-0.2.1/docs/tutorials.md +45 -0
  36. pyhuge-0.2.1/examples/run_huge_glasso.py +29 -0
  37. pyhuge-0.2.1/examples/run_huge_mb.py +23 -0
  38. pyhuge-0.2.1/examples/run_method_wrappers.py +24 -0
  39. pyhuge-0.2.1/examples/run_network_plot.py +22 -0
  40. pyhuge-0.2.1/examples/run_sim_inference_roc.py +24 -0
  41. pyhuge-0.2.1/examples/run_summary_and_plot.py +35 -0
  42. pyhuge-0.2.1/pyhuge/__init__.py +96 -0
  43. pyhuge-0.2.1/pyhuge/core.py +954 -0
  44. pyhuge-0.2.1/pyhuge.egg-info/PKG-INFO +252 -0
  45. pyhuge-0.2.1/pyhuge.egg-info/SOURCES.txt +57 -0
  46. pyhuge-0.2.1/pyhuge.egg-info/dependency_links.txt +1 -0
  47. pyhuge-0.2.1/pyhuge.egg-info/requires.txt +27 -0
  48. pyhuge-0.2.1/pyhuge.egg-info/top_level.txt +1 -0
  49. pyhuge-0.2.1/pyproject.toml +72 -0
  50. pyhuge-0.2.1/scripts/build_dist.sh +12 -0
  51. pyhuge-0.2.1/scripts/build_docs.sh +10 -0
  52. pyhuge-0.2.1/scripts/bump_version.py +78 -0
  53. pyhuge-0.2.1/scripts/release.sh +24 -0
  54. pyhuge-0.2.1/setup.cfg +4 -0
  55. pyhuge-0.2.1/tests/conftest.py +10 -0
  56. pyhuge-0.2.1/tests/test_core_unit.py +419 -0
  57. pyhuge-0.2.1/tests/test_e2e_optional.py +149 -0
  58. pyhuge-0.2.1/tests/test_public_api.py +54 -0
  59. pyhuge-0.2.1/tests/test_runtime_errors.py +19 -0
@@ -0,0 +1,71 @@
1
+ # Changelog
2
+
3
+ ## 0.2.1
4
+
5
+ - Fix CI e2e runtime dependency installation by installing `Rcpp`, `RcppEigen`, and `igraph` in `R_LIBS_USER`.
6
+ - Make e2e pass criteria robust to pytest output formatting changes.
7
+ - Migrate rpy2 conversion calls to `get_conversion()` API to avoid deprecation warnings.
8
+ - Decouple docs build from `rpy2`/R runtime requirements and restrict docs deploy to the upstream repository.
9
+ - Update repository/documentation links and docs deployment target to `Gatech-Flash/huge`.
10
+
11
+
12
+ ## 0.2.0
13
+
14
+ - Prepare first publish-ready `pyhuge` release line.
15
+ - Reframe repository and package documentation to cover both R (`huge`) and Python (`pyhuge`) variants.
16
+ - Add `docs/man/` function manual pages (one page per public API), analogous to R `man/` lookup style.
17
+ - Add docs website deployment workflow (`python-package-docs`) and integrate manual pages into MkDocs navigation.
18
+ - Add runtime readiness helper `pyhuge.test(require_runtime=...)` and corresponding public API tests.
19
+ - Add packaging metadata and manifest improvements for release/distribution (`MANIFEST.in`, project URLs, include-package-data).
20
+ - Keep Python test matrix and optional R-runtime e2e path aligned with current wrapper scope.
21
+
22
+
23
+ ## 0.1.0
24
+
25
+ - Initial Python wrapper package `pyhuge`.
26
+ - Implemented APIs:
27
+ - `huge`
28
+ - `huge_mb`
29
+ - `huge_glasso`
30
+ - `huge_ct`
31
+ - `huge_tiger`
32
+ - `huge_select`
33
+ - `huge_npn`
34
+ - `huge_generator`
35
+ - `huge_inference`
36
+ - `huge_roc`
37
+ - Added utility APIs:
38
+ - `huge_summary`
39
+ - `huge_select_summary`
40
+ - `huge_plot_sparsity`
41
+ - `huge_plot_roc`
42
+ - `huge_plot_graph_matrix`
43
+ - `huge_plot_network`
44
+ - `test` (runtime readiness probe)
45
+ - Added strict argument validation with clear `PyHugeError` messages.
46
+ - Expanded optional end-to-end tests (`tests/test_e2e_optional.py`) to cover:
47
+ - method wrappers (`mb`, `ct`, `tiger`, `glasso`)
48
+ - model selection (`ric`, `stars`, `ebic`)
49
+ - `huge_npn`, `huge_generator`, `huge_roc`, `huge_inference`
50
+ - summary helpers and network plotting
51
+ - Added CI split:
52
+ - `unit` matrix job (pure Python tests)
53
+ - `e2e-r-runtime` job (R+rpy2 integration tests)
54
+ - Added Python package release automation:
55
+ - `scripts/bump_version.py`
56
+ - `scripts/build_dist.sh`
57
+ - `scripts/release.sh`
58
+ - `.github/workflows/python-package-release.yml`
59
+ - Added Python docs website workflow:
60
+ - `.github/workflows/python-package-docs.yml`
61
+ - strict MkDocs build and GitHub Pages deployment
62
+ - Added result dataclasses:
63
+ - `HugeResult`
64
+ - `HugeSelectResult`
65
+ - Added MkDocs documentation set, including release process and architecture troubleshooting.
66
+ - Added docs pages for tutorials, performance notes, citation, and changelog index.
67
+ - Added `docs/man/` function manual pages (one page per public API function), analogous to R `man/` style lookup.
68
+ - Added packaging support files:
69
+ - `MANIFEST.in`
70
+ - Python package `.gitignore`
71
+ - Added examples and pytest test suite.
@@ -0,0 +1,60 @@
1
+ # Contributing (Python Wrapper)
2
+
3
+ ## Local setup
4
+
5
+ ```bash
6
+ cd python-package
7
+ pip install -e ".[dev]"
8
+ ```
9
+
10
+ ## Run tests
11
+
12
+ ```bash
13
+ pytest
14
+ ```
15
+
16
+ ## Run end-to-end tests with local R runtime
17
+
18
+ ```bash
19
+ export R_LIBS_USER=/Users/tourzhao/Desktop/huge-master/.Rlib
20
+ R CMD INSTALL /Users/tourzhao/Desktop/huge-master
21
+ pytest tests/test_e2e_optional.py -rA
22
+ ```
23
+
24
+ ## Run docs locally
25
+
26
+ ```bash
27
+ mkdocs serve
28
+ ```
29
+
30
+ ## Validate docs build (CI-equivalent)
31
+
32
+ ```bash
33
+ mkdocs build --strict
34
+ ```
35
+
36
+ ## Build wheel/sdist for release
37
+
38
+ ```bash
39
+ bash scripts/build_dist.sh
40
+ ```
41
+
42
+ ## Bump version and prepare release
43
+
44
+ ```bash
45
+ python scripts/bump_version.py 0.2.0
46
+ bash scripts/release.sh 0.2.0
47
+ ```
48
+
49
+ ## CI workflows
50
+
51
+ - Tests: `.github/workflows/python-wrapper-tests.yml`
52
+ - Docs website: `.github/workflows/python-package-docs.yml`
53
+ - Package release: `.github/workflows/python-package-release.yml`
54
+
55
+ ## Code principles
56
+
57
+ - Keep public API aligned with R package semantics.
58
+ - Preserve backward compatibility in result fields.
59
+ - Convert graph outputs to SciPy sparse matrices when possible.
60
+ - Keep `raw` R objects available for advanced users.
@@ -0,0 +1,10 @@
1
+ include README.md
2
+ include CHANGELOG.md
3
+ include CONTRIBUTING.md
4
+ include pyproject.toml
5
+ recursive-include docs *.md
6
+ recursive-include examples *.py
7
+ recursive-include scripts *.py *.sh
8
+ recursive-include tests *.py
9
+ recursive-include pyhuge *.py
10
+ global-exclude __pycache__ *.py[cod]
pyhuge-0.2.1/PKG-INFO ADDED
@@ -0,0 +1,252 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyhuge
3
+ Version: 0.2.1
4
+ Summary: Python wrapper for the R package huge
5
+ Author-email: Tuo Zhao <tourzhao@gatech.edu>
6
+ License: GPL-2.0-only
7
+ Project-URL: Homepage, https://github.com/Gatech-Flash/huge
8
+ Project-URL: Repository, https://github.com/Gatech-Flash/huge
9
+ Project-URL: Documentation, https://gatech-flash.github.io/huge/
10
+ Project-URL: Issues, https://github.com/Gatech-Flash/huge/issues
11
+ Project-URL: Changelog, https://github.com/Gatech-Flash/huge/blob/master/python-package/CHANGELOG.md
12
+ Keywords: graphical-model,graphical-lasso,sparse,statistics,rpy2
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3 :: Only
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
17
+ Classifier: License :: OSI Approved :: GNU General Public License v2 (GPLv2)
18
+ Requires-Python: >=3.9
19
+ Description-Content-Type: text/markdown
20
+ Requires-Dist: numpy>=1.23
21
+ Requires-Dist: scipy>=1.9
22
+ Requires-Dist: rpy2>=3.5
23
+ Provides-Extra: docs
24
+ Requires-Dist: mkdocs>=1.5; extra == "docs"
25
+ Requires-Dist: mkdocs-material>=9.5; extra == "docs"
26
+ Provides-Extra: test
27
+ Requires-Dist: pytest>=7.4; extra == "test"
28
+ Provides-Extra: dev
29
+ Requires-Dist: pytest>=7.4; extra == "dev"
30
+ Requires-Dist: matplotlib>=3.8; extra == "dev"
31
+ Requires-Dist: networkx>=3.2; extra == "dev"
32
+ Requires-Dist: build>=1.2; extra == "dev"
33
+ Requires-Dist: twine>=5.1; extra == "dev"
34
+ Requires-Dist: mkdocs>=1.5; extra == "dev"
35
+ Requires-Dist: mkdocs-material>=9.5; extra == "dev"
36
+ Provides-Extra: viz
37
+ Requires-Dist: matplotlib>=3.8; extra == "viz"
38
+ Requires-Dist: networkx>=3.2; extra == "viz"
39
+ Provides-Extra: release
40
+ Requires-Dist: build>=1.2; extra == "release"
41
+ Requires-Dist: twine>=5.1; extra == "release"
42
+
43
+ # pyhuge Python Package
44
+
45
+ [![Python wrapper tests](https://github.com/Gatech-Flash/huge/actions/workflows/python-wrapper-tests.yml/badge.svg)](https://github.com/Gatech-Flash/huge/actions/workflows/python-wrapper-tests.yml)
46
+ [![Python docs](https://github.com/Gatech-Flash/huge/actions/workflows/python-package-docs.yml/badge.svg)](https://github.com/Gatech-Flash/huge/actions/workflows/python-package-docs.yml)
47
+ [![Python package release](https://github.com/Gatech-Flash/huge/actions/workflows/python-package-release.yml/badge.svg)](https://github.com/Gatech-Flash/huge/actions/workflows/python-package-release.yml)
48
+
49
+ `pyhuge` is the Python wrapper for the
50
+ [`huge`](https://cran.r-project.org/package=huge) package:
51
+ High-dimensional Undirected Graph Estimation.
52
+
53
+ ## Table of contents
54
+
55
+ - [Background](#background)
56
+ - [Directory structure](#directory-structure)
57
+ - [What this package provides](#what-this-package-provides)
58
+ - [Requirements](#requirements)
59
+ - [Installation](#installation)
60
+ - [Usage](#usage)
61
+ - [Documentation and tutorials](#documentation-and-tutorials)
62
+ - [Performance notes](#performance-notes)
63
+ - [Implemented APIs](#implemented-apis)
64
+ - [For developer](#for-developer)
65
+ - [Citation](#citation)
66
+ - [References](#references)
67
+
68
+ ## Background
69
+
70
+ `huge` is widely used for sparse undirected graphical model estimation in high dimensions.
71
+ `pyhuge` keeps the original R/C++ backend and exposes a Python API via `rpy2` so Python users can:
72
+
73
+ - call the same core methods (`mb`, `glasso`, `ct`, `tiger`);
74
+ - run model selection (`ric`, `stars`, `ebic`);
75
+ - access simulation, ROC, and inference helpers;
76
+ - work with `numpy` and `scipy.sparse` objects directly.
77
+
78
+ ## Directory structure
79
+
80
+ The Python package directory is organized as:
81
+
82
+ - `pyhuge/`: Python wrapper source code
83
+ - `tests/`: unit/runtime/e2e tests
84
+ - `examples/`: runnable scripts
85
+ - `docs/`: MkDocs documentation pages
86
+ - `scripts/`: release and docs build scripts
87
+
88
+ ## What this package provides
89
+
90
+ - Thin and stable bridge to mature `huge` backend.
91
+ - Argument validation with explicit `PyHugeError` messages.
92
+ - Typed result objects.
93
+ - Plot helpers including node-edge network visualization (`huge_plot_network`).
94
+ - Tests, documentation website workflow, and release automation scripts.
95
+
96
+ ## Requirements
97
+
98
+ - Python `>=3.9`
99
+ - R installed and available in PATH
100
+ - R package `huge` installed (with `Rcpp`, `RcppEigen`, `igraph`, etc.)
101
+ - Python and R architecture must match (both `arm64` or both `x86_64`)
102
+
103
+ ## Installation
104
+
105
+ Install from source:
106
+
107
+ ```bash
108
+ git clone https://github.com/Gatech-Flash/huge.git
109
+ cd huge/python-package
110
+ pip install -e .
111
+ ```
112
+
113
+ Install directly from GitHub:
114
+
115
+ ```bash
116
+ pip install "git+https://github.com/Gatech-Flash/huge.git#subdirectory=python-package"
117
+ ```
118
+
119
+ Optional extras:
120
+
121
+ ```bash
122
+ pip install -e ".[viz]" # matplotlib + networkx
123
+ pip install -e ".[release]" # build + twine
124
+ pip install -e ".[dev]" # test + docs + release deps
125
+ ```
126
+
127
+ Runtime check:
128
+
129
+ ```bash
130
+ python -c "import pyhuge; print(pyhuge.test())"
131
+ ```
132
+
133
+ If `runtime=False`, verify `R_LIBS_USER`, architecture match, and `huge` visibility in R.
134
+
135
+ ## Usage
136
+
137
+ ```python
138
+ import numpy as np
139
+ from pyhuge import huge, huge_npn, huge_select
140
+
141
+ rng = np.random.default_rng(1)
142
+ x = rng.normal(size=(120, 30))
143
+ x_npn = huge_npn(x, npn_func="shrinkage", verbose=False)
144
+
145
+ fit = huge(x_npn, method="mb", nlambda=8, verbose=False)
146
+ sel = huge_select(fit, criterion="ric", verbose=False)
147
+ print(fit.method, len(fit.path), sel.opt_lambda, sel.opt_sparsity)
148
+ ```
149
+
150
+ Network visualization:
151
+
152
+ ```python
153
+ import matplotlib.pyplot as plt
154
+ from pyhuge import huge_plot_network
155
+
156
+ fig, ax = plt.subplots(figsize=(5, 5))
157
+ huge_plot_network(fit, index=-1, ax=ax, layout="spring")
158
+ plt.show()
159
+ ```
160
+
161
+ ## Documentation and tutorials
162
+
163
+ - Website: <https://gatech-flash.github.io/huge/>
164
+ - Docs source: `python-package/docs`
165
+ - Function manual directory: `python-package/docs/man` (R `man/`-style layout)
166
+ - Tutorial scripts: `python-package/examples`
167
+
168
+ Build docs locally:
169
+
170
+ ```bash
171
+ cd python-package
172
+ mkdocs serve
173
+ ```
174
+
175
+ Run tutorials/examples:
176
+
177
+ ```bash
178
+ cd python-package
179
+ python examples/run_huge_mb.py
180
+ python examples/run_summary_and_plot.py
181
+ python examples/run_network_plot.py
182
+ ```
183
+
184
+ If you use custom R library path:
185
+
186
+ ```bash
187
+ R_LIBS_USER=/Users/tourzhao/Desktop/huge-master/.Rlib \
188
+ python examples/run_huge_mb.py
189
+ ```
190
+
191
+ ## Performance notes
192
+
193
+ `pyhuge` runtime is dominated by R backend solve time for medium/large problems.
194
+ For many tiny repeated calls, Python-R bridge overhead can matter.
195
+ Benchmark backend and end-to-end workflows separately when tuning performance.
196
+
197
+ ## Implemented APIs
198
+
199
+ - `huge`, `huge_mb`, `huge_glasso`, `huge_ct`, `huge_tiger`
200
+ - `huge_select`, `huge_npn`
201
+ - `huge_generator`, `huge_inference`, `huge_roc`
202
+ - `huge_summary`, `huge_select_summary`
203
+ - `huge_plot_sparsity`, `huge_plot_roc`, `huge_plot_graph_matrix`, `huge_plot_network`
204
+ - `test`
205
+
206
+ ## For developer
207
+
208
+ ```bash
209
+ cd python-package
210
+ pip install -e ".[dev]"
211
+ pytest
212
+ mkdocs build --strict
213
+ bash scripts/build_docs.sh
214
+ bash scripts/build_dist.sh
215
+ ```
216
+
217
+ Optional e2e run with local R runtime:
218
+
219
+ ```bash
220
+ export R_LIBS_USER=/Users/tourzhao/Desktop/huge-master/.Rlib
221
+ export PYHUGE_REQUIRE_RUNTIME=1
222
+ pytest tests/test_e2e_optional.py -rA
223
+ ```
224
+
225
+ Workflows:
226
+
227
+ - `.github/workflows/python-wrapper-tests.yml`
228
+ - `.github/workflows/python-package-docs.yml`
229
+ - `.github/workflows/python-package-release.yml`
230
+
231
+ ## Citation
232
+
233
+ If you use `huge` / `pyhuge` in research, cite:
234
+
235
+ ```bibtex
236
+ @article{zhao2012huge,
237
+ title = {The huge Package for High-dimensional Undirected Graph Estimation in R},
238
+ author = {Zhao, Tuo and Liu, Han and Roeder, Kathryn and Lafferty, John and Wasserman, Larry},
239
+ journal = {Journal of Machine Learning Research},
240
+ volume = {13},
241
+ pages = {1059--1062},
242
+ year = {2012}
243
+ }
244
+ ```
245
+
246
+ ## References
247
+
248
+ - T. Zhao, H. Liu, K. Roeder, J. Lafferty, and L. Wasserman,
249
+ *The huge Package for High-dimensional Undirected Graph Estimation in R*,
250
+ JMLR 13:1059-1062, 2012.
251
+ - Huge CRAN page: <https://cran.r-project.org/package=huge>
252
+ - Repository: <https://github.com/Gatech-Flash/huge>
pyhuge-0.2.1/README.md ADDED
@@ -0,0 +1,210 @@
1
+ # pyhuge Python Package
2
+
3
+ [![Python wrapper tests](https://github.com/Gatech-Flash/huge/actions/workflows/python-wrapper-tests.yml/badge.svg)](https://github.com/Gatech-Flash/huge/actions/workflows/python-wrapper-tests.yml)
4
+ [![Python docs](https://github.com/Gatech-Flash/huge/actions/workflows/python-package-docs.yml/badge.svg)](https://github.com/Gatech-Flash/huge/actions/workflows/python-package-docs.yml)
5
+ [![Python package release](https://github.com/Gatech-Flash/huge/actions/workflows/python-package-release.yml/badge.svg)](https://github.com/Gatech-Flash/huge/actions/workflows/python-package-release.yml)
6
+
7
+ `pyhuge` is the Python wrapper for the
8
+ [`huge`](https://cran.r-project.org/package=huge) package:
9
+ High-dimensional Undirected Graph Estimation.
10
+
11
+ ## Table of contents
12
+
13
+ - [Background](#background)
14
+ - [Directory structure](#directory-structure)
15
+ - [What this package provides](#what-this-package-provides)
16
+ - [Requirements](#requirements)
17
+ - [Installation](#installation)
18
+ - [Usage](#usage)
19
+ - [Documentation and tutorials](#documentation-and-tutorials)
20
+ - [Performance notes](#performance-notes)
21
+ - [Implemented APIs](#implemented-apis)
22
+ - [For developer](#for-developer)
23
+ - [Citation](#citation)
24
+ - [References](#references)
25
+
26
+ ## Background
27
+
28
+ `huge` is widely used for sparse undirected graphical model estimation in high dimensions.
29
+ `pyhuge` keeps the original R/C++ backend and exposes a Python API via `rpy2` so Python users can:
30
+
31
+ - call the same core methods (`mb`, `glasso`, `ct`, `tiger`);
32
+ - run model selection (`ric`, `stars`, `ebic`);
33
+ - access simulation, ROC, and inference helpers;
34
+ - work with `numpy` and `scipy.sparse` objects directly.
35
+
36
+ ## Directory structure
37
+
38
+ The Python package directory is organized as:
39
+
40
+ - `pyhuge/`: Python wrapper source code
41
+ - `tests/`: unit/runtime/e2e tests
42
+ - `examples/`: runnable scripts
43
+ - `docs/`: MkDocs documentation pages
44
+ - `scripts/`: release and docs build scripts
45
+
46
+ ## What this package provides
47
+
48
+ - Thin and stable bridge to mature `huge` backend.
49
+ - Argument validation with explicit `PyHugeError` messages.
50
+ - Typed result objects.
51
+ - Plot helpers including node-edge network visualization (`huge_plot_network`).
52
+ - Tests, documentation website workflow, and release automation scripts.
53
+
54
+ ## Requirements
55
+
56
+ - Python `>=3.9`
57
+ - R installed and available in PATH
58
+ - R package `huge` installed (with `Rcpp`, `RcppEigen`, `igraph`, etc.)
59
+ - Python and R architecture must match (both `arm64` or both `x86_64`)
60
+
61
+ ## Installation
62
+
63
+ Install from source:
64
+
65
+ ```bash
66
+ git clone https://github.com/Gatech-Flash/huge.git
67
+ cd huge/python-package
68
+ pip install -e .
69
+ ```
70
+
71
+ Install directly from GitHub:
72
+
73
+ ```bash
74
+ pip install "git+https://github.com/Gatech-Flash/huge.git#subdirectory=python-package"
75
+ ```
76
+
77
+ Optional extras:
78
+
79
+ ```bash
80
+ pip install -e ".[viz]" # matplotlib + networkx
81
+ pip install -e ".[release]" # build + twine
82
+ pip install -e ".[dev]" # test + docs + release deps
83
+ ```
84
+
85
+ Runtime check:
86
+
87
+ ```bash
88
+ python -c "import pyhuge; print(pyhuge.test())"
89
+ ```
90
+
91
+ If `runtime=False`, verify `R_LIBS_USER`, architecture match, and `huge` visibility in R.
92
+
93
+ ## Usage
94
+
95
+ ```python
96
+ import numpy as np
97
+ from pyhuge import huge, huge_npn, huge_select
98
+
99
+ rng = np.random.default_rng(1)
100
+ x = rng.normal(size=(120, 30))
101
+ x_npn = huge_npn(x, npn_func="shrinkage", verbose=False)
102
+
103
+ fit = huge(x_npn, method="mb", nlambda=8, verbose=False)
104
+ sel = huge_select(fit, criterion="ric", verbose=False)
105
+ print(fit.method, len(fit.path), sel.opt_lambda, sel.opt_sparsity)
106
+ ```
107
+
108
+ Network visualization:
109
+
110
+ ```python
111
+ import matplotlib.pyplot as plt
112
+ from pyhuge import huge_plot_network
113
+
114
+ fig, ax = plt.subplots(figsize=(5, 5))
115
+ huge_plot_network(fit, index=-1, ax=ax, layout="spring")
116
+ plt.show()
117
+ ```
118
+
119
+ ## Documentation and tutorials
120
+
121
+ - Website: <https://gatech-flash.github.io/huge/>
122
+ - Docs source: `python-package/docs`
123
+ - Function manual directory: `python-package/docs/man` (R `man/`-style layout)
124
+ - Tutorial scripts: `python-package/examples`
125
+
126
+ Build docs locally:
127
+
128
+ ```bash
129
+ cd python-package
130
+ mkdocs serve
131
+ ```
132
+
133
+ Run tutorials/examples:
134
+
135
+ ```bash
136
+ cd python-package
137
+ python examples/run_huge_mb.py
138
+ python examples/run_summary_and_plot.py
139
+ python examples/run_network_plot.py
140
+ ```
141
+
142
+ If you use custom R library path:
143
+
144
+ ```bash
145
+ R_LIBS_USER=/Users/tourzhao/Desktop/huge-master/.Rlib \
146
+ python examples/run_huge_mb.py
147
+ ```
148
+
149
+ ## Performance notes
150
+
151
+ `pyhuge` runtime is dominated by R backend solve time for medium/large problems.
152
+ For many tiny repeated calls, Python-R bridge overhead can matter.
153
+ Benchmark backend and end-to-end workflows separately when tuning performance.
154
+
155
+ ## Implemented APIs
156
+
157
+ - `huge`, `huge_mb`, `huge_glasso`, `huge_ct`, `huge_tiger`
158
+ - `huge_select`, `huge_npn`
159
+ - `huge_generator`, `huge_inference`, `huge_roc`
160
+ - `huge_summary`, `huge_select_summary`
161
+ - `huge_plot_sparsity`, `huge_plot_roc`, `huge_plot_graph_matrix`, `huge_plot_network`
162
+ - `test`
163
+
164
+ ## For developer
165
+
166
+ ```bash
167
+ cd python-package
168
+ pip install -e ".[dev]"
169
+ pytest
170
+ mkdocs build --strict
171
+ bash scripts/build_docs.sh
172
+ bash scripts/build_dist.sh
173
+ ```
174
+
175
+ Optional e2e run with local R runtime:
176
+
177
+ ```bash
178
+ export R_LIBS_USER=/Users/tourzhao/Desktop/huge-master/.Rlib
179
+ export PYHUGE_REQUIRE_RUNTIME=1
180
+ pytest tests/test_e2e_optional.py -rA
181
+ ```
182
+
183
+ Workflows:
184
+
185
+ - `.github/workflows/python-wrapper-tests.yml`
186
+ - `.github/workflows/python-package-docs.yml`
187
+ - `.github/workflows/python-package-release.yml`
188
+
189
+ ## Citation
190
+
191
+ If you use `huge` / `pyhuge` in research, cite:
192
+
193
+ ```bibtex
194
+ @article{zhao2012huge,
195
+ title = {The huge Package for High-dimensional Undirected Graph Estimation in R},
196
+ author = {Zhao, Tuo and Liu, Han and Roeder, Kathryn and Lafferty, John and Wasserman, Larry},
197
+ journal = {Journal of Machine Learning Research},
198
+ volume = {13},
199
+ pages = {1059--1062},
200
+ year = {2012}
201
+ }
202
+ ```
203
+
204
+ ## References
205
+
206
+ - T. Zhao, H. Liu, K. Roeder, J. Lafferty, and L. Wasserman,
207
+ *The huge Package for High-dimensional Undirected Graph Estimation in R*,
208
+ JMLR 13:1059-1062, 2012.
209
+ - Huge CRAN page: <https://cran.r-project.org/package=huge>
210
+ - Repository: <https://github.com/Gatech-Flash/huge>