hnep 0.1.0__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.
- hnep-0.1.0/CHANGELOG.md +83 -0
- hnep-0.1.0/CONTRIBUTING_HNEP.md +58 -0
- hnep-0.1.0/LICENSE +21 -0
- hnep-0.1.0/MANIFEST.in +28 -0
- hnep-0.1.0/PKG-INFO +215 -0
- hnep-0.1.0/README.md +609 -0
- hnep-0.1.0/README_HNEP.md +147 -0
- hnep-0.1.0/docs_hnep/Makefile +20 -0
- hnep-0.1.0/docs_hnep/api.rst +85 -0
- hnep-0.1.0/docs_hnep/concepts.rst +71 -0
- hnep-0.1.0/docs_hnep/conf.py +68 -0
- hnep-0.1.0/docs_hnep/index.rst +56 -0
- hnep-0.1.0/docs_hnep/quickstart.rst +94 -0
- hnep-0.1.0/docs_hnep/tutorial.rst +153 -0
- hnep-0.1.0/hnep/__init__.py +76 -0
- hnep-0.1.0/hnep/adapters/__init__.py +36 -0
- hnep-0.1.0/hnep/adapters/base.py +159 -0
- hnep-0.1.0/hnep/adapters/functional.py +106 -0
- hnep-0.1.0/hnep/adapters/jax_flax.py +191 -0
- hnep-0.1.0/hnep/adapters/precomputed.py +131 -0
- hnep-0.1.0/hnep/adapters/pytorch.py +173 -0
- hnep-0.1.0/hnep/api.py +91 -0
- hnep-0.1.0/hnep/classifiers/__init__.py +5 -0
- hnep-0.1.0/hnep/classifiers/qct.py +75 -0
- hnep-0.1.0/hnep/cli.py +57 -0
- hnep-0.1.0/hnep/cost_utility/__init__.py +24 -0
- hnep-0.1.0/hnep/cost_utility/hardware_cost.py +75 -0
- hnep-0.1.0/hnep/cost_utility/pareto.py +70 -0
- hnep-0.1.0/hnep/cost_utility/qus.py +65 -0
- hnep-0.1.0/hnep/datasets/__init__.py +1 -0
- hnep-0.1.0/hnep/examples/00_quickstart.py +134 -0
- hnep-0.1.0/hnep/examples/01_functional_adapter.py +94 -0
- hnep-0.1.0/hnep/examples/02_precomputed_adapter.py +60 -0
- hnep-0.1.0/hnep/examples/03_visualizations.py +61 -0
- hnep-0.1.0/hnep/examples/04_compare_models.py +44 -0
- hnep-0.1.0/hnep/examples/05_custom_probe.py +120 -0
- hnep-0.1.0/hnep/examples/__init__.py +1 -0
- hnep-0.1.0/hnep/examples/quickstart_helpers.py +80 -0
- hnep-0.1.0/hnep/probes/__init__.py +22 -0
- hnep-0.1.0/hnep/probes/base.py +65 -0
- hnep-0.1.0/hnep/probes/intervention.py +214 -0
- hnep-0.1.0/hnep/probes/surrogation.py +248 -0
- hnep-0.1.0/hnep/py.typed +0 -0
- hnep-0.1.0/hnep/reports/__init__.py +5 -0
- hnep-0.1.0/hnep/reports/html.py +221 -0
- hnep-0.1.0/hnep/results/__init__.py +6 -0
- hnep-0.1.0/hnep/results/hnep_result.py +134 -0
- hnep-0.1.0/hnep/results/probe_result.py +73 -0
- hnep-0.1.0/hnep/thresholds.py +37 -0
- hnep-0.1.0/hnep/utils/__init__.py +1 -0
- hnep-0.1.0/hnep/utils/bootstrap.py +66 -0
- hnep-0.1.0/hnep/utils/reproducibility.py +20 -0
- hnep-0.1.0/hnep/utils/serialise.py +31 -0
- hnep-0.1.0/hnep/visualizations/__init__.py +11 -0
- hnep-0.1.0/hnep/visualizations/pareto.py +120 -0
- hnep-0.1.0/hnep/visualizations/qct_plane.py +141 -0
- hnep-0.1.0/hnep/visualizations/radar.py +94 -0
- hnep-0.1.0/hnep.egg-info/PKG-INFO +215 -0
- hnep-0.1.0/hnep.egg-info/SOURCES.txt +74 -0
- hnep-0.1.0/hnep.egg-info/dependency_links.txt +1 -0
- hnep-0.1.0/hnep.egg-info/entry_points.txt +2 -0
- hnep-0.1.0/hnep.egg-info/requires.txt +46 -0
- hnep-0.1.0/hnep.egg-info/top_level.txt +1 -0
- hnep-0.1.0/pyproject.toml +110 -0
- hnep-0.1.0/setup.cfg +4 -0
- hnep-0.1.0/setup.py +53 -0
- hnep-0.1.0/tests/__init__.py +0 -0
- hnep-0.1.0/tests/test_adapters.py +188 -0
- hnep-0.1.0/tests/test_classical_model.py +58 -0
- hnep-0.1.0/tests/test_data_loaders.py +145 -0
- hnep-0.1.0/tests/test_models.py +217 -0
- hnep-0.1.0/tests/test_phase3.py +156 -0
- hnep-0.1.0/tests/test_probes.py +250 -0
- hnep-0.1.0/tests/test_quantum_circuits.py +45 -0
- hnep-0.1.0/tests/test_smoke.py +140 -0
- hnep-0.1.0/tests/test_training.py +203 -0
hnep-0.1.0/CHANGELOG.md
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to HNEP are documented here.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/) and
|
|
6
|
+
this project adheres to [Semantic Versioning](https://semver.org/).
|
|
7
|
+
|
|
8
|
+
## [0.1.0] — 2026-06-21
|
|
9
|
+
|
|
10
|
+
First public release. The library is feature-complete for the QCT workflow
|
|
11
|
+
and is published as an **alpha** — APIs may shift in 0.x as users discover
|
|
12
|
+
edge cases. Semver guarantees begin at 1.0.
|
|
13
|
+
|
|
14
|
+
### Added — Core
|
|
15
|
+
- `hnep.evaluate(model, dataset)` — top-level one-line evaluation.
|
|
16
|
+
- `HNEPResult` aggregating QCT verdict + per-probe results + manifest, with
|
|
17
|
+
`.to_html()`, `.to_json()`, `.to_csv()` exports.
|
|
18
|
+
- `Dataset`, `ModelInterface` — the framework-agnostic adapter contract.
|
|
19
|
+
|
|
20
|
+
### Added — Probes
|
|
21
|
+
- `SurrogationProbe` — 8-surrogate ladder (Ridge, KNN, RF, GB, four MLPs)
|
|
22
|
+
with bootstrap confidence intervals and the most-conservative headline SS.
|
|
23
|
+
- `InterventionProbe` — `do()`-operator family: `zero_quantum`,
|
|
24
|
+
`random_noise`, `permute`, `constant`. Headline = zero-quantum drop.
|
|
25
|
+
- Both probes report per-sample data, per-sub-probe scores, and a notes
|
|
26
|
+
field for caveats (e.g. surrogate failure modes).
|
|
27
|
+
|
|
28
|
+
### Added — Classifier
|
|
29
|
+
- `QCTClassifier` mapping (surrogation, intervention) → one of
|
|
30
|
+
`Genuine` / `Regularizer` / `Ignored` / `Dead Weight` / `Inconclusive`.
|
|
31
|
+
- Inconclusive is emitted when a bootstrap CI straddles a threshold.
|
|
32
|
+
- Tunable thresholds via `Thresholds(ss_replaceable, intervention_load_bearing)`.
|
|
33
|
+
|
|
34
|
+
### Added — Adapters
|
|
35
|
+
- `FunctionalAdapter` — wrap any model with three callables.
|
|
36
|
+
- `PrecomputedAdapter` — wrap cached arrays + a decoder function.
|
|
37
|
+
- `JaxFlaxAdapter` — for Flax models conforming to the thesis surface
|
|
38
|
+
(`forward_with_quantum`, `extract_quantum_outputs`).
|
|
39
|
+
- `PyTorchAdapter` — skeleton template subclassed by the user.
|
|
40
|
+
- Heavier adapters lazy-import their framework (`hnep[jax]` / `hnep[pytorch]`).
|
|
41
|
+
|
|
42
|
+
### Added — Cost-utility
|
|
43
|
+
- `compute_qus()` returning a `QuantumUtilityScore` (R² gain per compute
|
|
44
|
+
multiplier) with a categorical verdict.
|
|
45
|
+
- `pareto_frontier()` filtering dominated points in (accuracy, cost) space.
|
|
46
|
+
- `estimate_hardware_cost()` projecting NISQ cost across IBM / IonQ /
|
|
47
|
+
Rigetti / IQM (indicative, user-overridable).
|
|
48
|
+
|
|
49
|
+
### Added — Visualisations
|
|
50
|
+
- `plot_qct_plane()` — the HNEP logo. Four shaded quadrants, threshold
|
|
51
|
+
lines, confidence rectangles per model.
|
|
52
|
+
- `plot_convergent_validity_radar()` — N-axis radar (one per probe),
|
|
53
|
+
overlay multiple models.
|
|
54
|
+
- `plot_pareto_with_hardware_cost()` — log-x R² vs compute with optional
|
|
55
|
+
NISQ price annotations.
|
|
56
|
+
|
|
57
|
+
### Added — Reports
|
|
58
|
+
- `render_html_report()` — self-contained HTML report with embedded base64
|
|
59
|
+
figures, verdict card colour-coded by QCT class, probe table with
|
|
60
|
+
confidence bars, manifest section.
|
|
61
|
+
- `HNEPResult.to_html(path, other_results=...)` for A/B comparisons.
|
|
62
|
+
|
|
63
|
+
### Added — Tooling
|
|
64
|
+
- `hnep` CLI with `--version` and stubs for `evaluate` / `replay`.
|
|
65
|
+
- Manifest files (`hnep_version`, `timestamp`, `platform`, `thresholds`,
|
|
66
|
+
probes run, runtime) attached to every result.
|
|
67
|
+
- Sphinx documentation site (Furo theme).
|
|
68
|
+
- GitHub Actions CI: tests across Python 3.9 – 3.12, lint, build, docs.
|
|
69
|
+
- Type-hint marker (`py.typed`).
|
|
70
|
+
- pyproject extras: `[jax]`, `[pytorch]`, `[pennylane]`, `[qiskit]`,
|
|
71
|
+
`[molecular]`, `[reports]`, `[all]`, `[dev]`.
|
|
72
|
+
|
|
73
|
+
### Tests
|
|
74
|
+
- 77 tests passing — smoke, probes, classifier, cost-utility, visuals,
|
|
75
|
+
reports, adapters.
|
|
76
|
+
|
|
77
|
+
### Known limitations
|
|
78
|
+
- Probe thresholds are picked by inspection (SS < 0.2, Δ ≥ 0.05). A
|
|
79
|
+
permutation-derived threshold is on the v0.2 roadmap.
|
|
80
|
+
- Visualisation styling is not yet customisable.
|
|
81
|
+
- `hnep evaluate` and `hnep replay` CLI subcommands are stubs (full
|
|
82
|
+
wire-up lands in v0.2).
|
|
83
|
+
- Molecular utilities (RDKit gallery, atom-level QCI) are scheduled for v0.2.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Contributing to HNEP
|
|
2
|
+
|
|
3
|
+
Thanks for your interest in making HNEP better.
|
|
4
|
+
|
|
5
|
+
HNEP is an alpha-stage library: APIs are still moving, and bug reports +
|
|
6
|
+
feature suggestions are especially welcome.
|
|
7
|
+
|
|
8
|
+
## Quick links
|
|
9
|
+
- 🐛 Bug report: open a GitHub issue with the `bug` label.
|
|
10
|
+
- 💡 Feature suggestion: open a GitHub issue with the `enhancement` label.
|
|
11
|
+
- 📖 Documentation fix: a PR is faster than an issue.
|
|
12
|
+
- 🤔 Methodology question: open a GitHub discussion rather than an issue.
|
|
13
|
+
|
|
14
|
+
## Setting up a dev environment
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
git clone https://github.com/pratikpriyanshu/hnep.git
|
|
18
|
+
cd hnep
|
|
19
|
+
python -m venv .venv
|
|
20
|
+
source .venv/bin/activate
|
|
21
|
+
pip install -e ".[dev]"
|
|
22
|
+
pytest tests/ -q
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Style + tests
|
|
26
|
+
|
|
27
|
+
- Format with **ruff** (`ruff format hnep tests`) — line length 100.
|
|
28
|
+
- Lint with **ruff** (`ruff check hnep tests`).
|
|
29
|
+
- All new functionality needs at least one test in `tests/`.
|
|
30
|
+
- For numerical results, prefer `pytest.approx` with explicit tolerances.
|
|
31
|
+
|
|
32
|
+
## Writing a new probe
|
|
33
|
+
|
|
34
|
+
A probe is a subclass of `hnep.Probe` that implements
|
|
35
|
+
`.run(model, dataset, verbose) -> ProbeResult`. The `ProbeResult` dataclass
|
|
36
|
+
is the uniform return format — see `hnep/examples/05_custom_probe.py` for
|
|
37
|
+
a worked example.
|
|
38
|
+
|
|
39
|
+
## Writing a new adapter
|
|
40
|
+
|
|
41
|
+
Adapters subclass `hnep.ModelInterface` and implement three methods:
|
|
42
|
+
`predict`, `extract_quantum_output`, `predict_with_quantum_override`.
|
|
43
|
+
Two optional hooks (`get_classical_embedding`, `get_quantum_input`) unlock
|
|
44
|
+
richer probes — implement them when you can.
|
|
45
|
+
|
|
46
|
+
## Submitting a PR
|
|
47
|
+
|
|
48
|
+
1. Fork the repo and create a feature branch.
|
|
49
|
+
2. Make the change. Add tests.
|
|
50
|
+
3. Run `pytest tests/`, `ruff check hnep tests`, and `ruff format --check
|
|
51
|
+
hnep tests`.
|
|
52
|
+
4. Update the `CHANGELOG.md` under `Unreleased`.
|
|
53
|
+
5. Open a PR. Small PRs review faster than large ones.
|
|
54
|
+
|
|
55
|
+
## Code of conduct
|
|
56
|
+
|
|
57
|
+
Be excellent to each other. The discussion norms are: ask before
|
|
58
|
+
assuming, criticise ideas not people, and assume good faith.
|
hnep-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Pratik Priyanshu
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
hnep-0.1.0/MANIFEST.in
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Tell setuptools what to include in the sdist beyond default heuristics.
|
|
2
|
+
|
|
3
|
+
include LICENSE
|
|
4
|
+
include README_HNEP.md
|
|
5
|
+
include CHANGELOG.md
|
|
6
|
+
include CONTRIBUTING_HNEP.md
|
|
7
|
+
include pyproject.toml
|
|
8
|
+
recursive-include hnep *.py *.typed
|
|
9
|
+
recursive-include hnep/examples *.py
|
|
10
|
+
recursive-include tests *.py
|
|
11
|
+
|
|
12
|
+
# Documentation source (for users who build docs from sdist)
|
|
13
|
+
recursive-include docs_hnep *.rst *.py Makefile
|
|
14
|
+
|
|
15
|
+
# Exclude development / thesis-only artifacts
|
|
16
|
+
prune src
|
|
17
|
+
prune scripts
|
|
18
|
+
prune notebooks
|
|
19
|
+
prune experiments
|
|
20
|
+
prune data
|
|
21
|
+
prune config
|
|
22
|
+
prune deployment
|
|
23
|
+
prune api
|
|
24
|
+
prune docs
|
|
25
|
+
|
|
26
|
+
global-exclude __pycache__
|
|
27
|
+
global-exclude *.py[cod]
|
|
28
|
+
global-exclude .DS_Store
|
hnep-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: hnep
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Hybrid Network Evaluation Protocol — multi-method evaluation for hybrid quantum-classical models
|
|
5
|
+
Author: Quantum Drug Discovery Team
|
|
6
|
+
Author-email: Pratik Priyanshu <priyanshupriyam123vv@gmail.com>
|
|
7
|
+
License: MIT
|
|
8
|
+
Project-URL: Homepage, https://github.com/pratikpriyanshu/hnep
|
|
9
|
+
Project-URL: Documentation, https://github.com/pratikpriyanshu/hnep
|
|
10
|
+
Project-URL: Source, https://github.com/pratikpriyanshu/hnep
|
|
11
|
+
Project-URL: Issues, https://github.com/pratikpriyanshu/hnep/issues
|
|
12
|
+
Keywords: quantum machine learning,evaluation,QML,hybrid models,benchmarking,surrogation,intervention
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
24
|
+
Requires-Python: >=3.9
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Requires-Dist: numpy>=1.24
|
|
28
|
+
Requires-Dist: scipy>=1.10
|
|
29
|
+
Requires-Dist: scikit-learn>=1.3
|
|
30
|
+
Requires-Dist: pandas>=2.0
|
|
31
|
+
Requires-Dist: matplotlib>=3.7
|
|
32
|
+
Requires-Dist: pyyaml>=6.0
|
|
33
|
+
Requires-Dist: tqdm>=4.65
|
|
34
|
+
Provides-Extra: jax
|
|
35
|
+
Requires-Dist: jax>=0.4.0; extra == "jax"
|
|
36
|
+
Requires-Dist: flax>=0.8.0; extra == "jax"
|
|
37
|
+
Requires-Dist: optax>=0.2.0; extra == "jax"
|
|
38
|
+
Provides-Extra: pytorch
|
|
39
|
+
Requires-Dist: torch>=2.0; extra == "pytorch"
|
|
40
|
+
Provides-Extra: qiskit
|
|
41
|
+
Requires-Dist: qiskit>=1.0; extra == "qiskit"
|
|
42
|
+
Provides-Extra: pennylane
|
|
43
|
+
Requires-Dist: pennylane>=0.35; extra == "pennylane"
|
|
44
|
+
Provides-Extra: molecular
|
|
45
|
+
Requires-Dist: rdkit; extra == "molecular"
|
|
46
|
+
Provides-Extra: reports
|
|
47
|
+
Requires-Dist: jinja2>=3.1; extra == "reports"
|
|
48
|
+
Requires-Dist: plotly>=5.18; extra == "reports"
|
|
49
|
+
Provides-Extra: all
|
|
50
|
+
Requires-Dist: jax>=0.4.0; extra == "all"
|
|
51
|
+
Requires-Dist: flax>=0.8.0; extra == "all"
|
|
52
|
+
Requires-Dist: optax>=0.2.0; extra == "all"
|
|
53
|
+
Requires-Dist: torch>=2.0; extra == "all"
|
|
54
|
+
Requires-Dist: pennylane>=0.35; extra == "all"
|
|
55
|
+
Requires-Dist: rdkit; extra == "all"
|
|
56
|
+
Requires-Dist: jinja2>=3.1; extra == "all"
|
|
57
|
+
Requires-Dist: plotly>=5.18; extra == "all"
|
|
58
|
+
Provides-Extra: dev
|
|
59
|
+
Requires-Dist: pytest>=7.4; extra == "dev"
|
|
60
|
+
Requires-Dist: pytest-cov>=4.1; extra == "dev"
|
|
61
|
+
Requires-Dist: ruff>=0.5; extra == "dev"
|
|
62
|
+
Requires-Dist: mypy>=1.5; extra == "dev"
|
|
63
|
+
Requires-Dist: build>=1.0; extra == "dev"
|
|
64
|
+
Requires-Dist: twine>=4.0; extra == "dev"
|
|
65
|
+
Dynamic: author
|
|
66
|
+
Dynamic: license-file
|
|
67
|
+
Dynamic: requires-python
|
|
68
|
+
|
|
69
|
+
# HNEP — Hybrid Network Evaluation Protocol
|
|
70
|
+
|
|
71
|
+
[](https://opensource.org/licenses/MIT)
|
|
72
|
+
[](https://www.python.org/)
|
|
73
|
+
[](#)
|
|
74
|
+
[](#)
|
|
75
|
+
[](#)
|
|
76
|
+
|
|
77
|
+
> **Does the quantum component in your hybrid model actually contribute meaningful computation, or could a classical surrogate replace it?**
|
|
78
|
+
|
|
79
|
+
Most QML benchmarks report end-task accuracy and call it a day.
|
|
80
|
+
**HNEP applies multiple independent probes** to your trained hybrid model — surrogation, structural intervention, error diversity, representation analysis — and returns a verdict you can defend.
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Install
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
pip install hnep
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Optional framework extras:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
pip install "hnep[jax]" # JAX / Flax models
|
|
94
|
+
pip install "hnep[pytorch]" # PyTorch models
|
|
95
|
+
pip install "hnep[pennylane]" # PennyLane quantum backend
|
|
96
|
+
pip install "hnep[molecular]" # RDKit-based molecular utilities
|
|
97
|
+
pip install "hnep[reports]" # interactive HTML reports (jinja2, plotly)
|
|
98
|
+
pip install "hnep[all]" # everything
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## 30-second quickstart
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
import hnep
|
|
105
|
+
|
|
106
|
+
# Wrap your trained model in any of HNEP's adapters
|
|
107
|
+
adapter = hnep.FunctionalAdapter(
|
|
108
|
+
name="my_model",
|
|
109
|
+
predict_fn=my_predict,
|
|
110
|
+
extract_quantum_fn=my_extract_quantum,
|
|
111
|
+
predict_with_override_fn=my_predict_override,
|
|
112
|
+
quantum_dim=4,
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
# Run the full HNEP protocol
|
|
116
|
+
result = hnep.evaluate(adapter, my_dataset)
|
|
117
|
+
|
|
118
|
+
print(result.qct_verdict) # → "Regularizer"
|
|
119
|
+
print(result.qct_confidence) # → 0.94
|
|
120
|
+
result.to_html("report.html") # full HTML report with figures
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
The report opens in your browser as a self-contained HTML file with the **QCT plane**, the **convergent-validity radar**, and a manifest your run can be replayed from.
|
|
124
|
+
|
|
125
|
+
## What HNEP returns
|
|
126
|
+
|
|
127
|
+
```text
|
|
128
|
+
HNEP Evaluation Report
|
|
129
|
+
============================================================
|
|
130
|
+
Model: Hybrid-V1
|
|
131
|
+
Dataset: ESOL (n=1128, scaffold split)
|
|
132
|
+
|
|
133
|
+
QCT Verdict: Regularizer (confidence: 0.94)
|
|
134
|
+
------------------------------------------------------------
|
|
135
|
+
surrogation score=0.077 [0.06, 0.10] → REPLACEABLE
|
|
136
|
+
intervention score=0.29 [0.22, 0.36] → LOAD-BEARING
|
|
137
|
+
------------------------------------------------------------
|
|
138
|
+
|
|
139
|
+
Notes:
|
|
140
|
+
• Surrogate swap is safe at inference. Quantum's role appears
|
|
141
|
+
confined to the training phase.
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## The QCT taxonomy
|
|
145
|
+
|
|
146
|
+
HNEP classifies your model into one of four roles plus an honest fallback:
|
|
147
|
+
|
|
148
|
+
| | LOAD-BEARING | NOT LOAD-BEARING |
|
|
149
|
+
|----------------|---------------------|--------------------|
|
|
150
|
+
| **NECESSARY** | Genuine Contributor | Unique-but-Ignored |
|
|
151
|
+
| **REPLACEABLE**| Architectural Regularizer | Dead Weight |
|
|
152
|
+
|
|
153
|
+
When the bootstrap confidence intervals straddle a threshold, HNEP returns `Inconclusive` rather than guessing.
|
|
154
|
+
|
|
155
|
+
## Adapters
|
|
156
|
+
|
|
157
|
+
Wrap your model in one line:
|
|
158
|
+
|
|
159
|
+
| Adapter | Use when |
|
|
160
|
+
|---------|----------|
|
|
161
|
+
| `FunctionalAdapter` | You can write three Python callbacks. **Most users start here.** |
|
|
162
|
+
| `PrecomputedAdapter` | You already cached the test-set extractions to disk. |
|
|
163
|
+
| `JaxFlaxAdapter` | Your model is a Flax module with our standard conventions. |
|
|
164
|
+
| `PyTorchAdapter` | Your model is a `torch.nn.Module` — subclass + override 2 hooks. |
|
|
165
|
+
|
|
166
|
+
See [`hnep/examples/`](hnep/examples) for runnable examples of each.
|
|
167
|
+
|
|
168
|
+
## What's in v0.1.0
|
|
169
|
+
|
|
170
|
+
* Surrogation probe — 8-surrogate ladder (linear, KNN, trees, MLPs)
|
|
171
|
+
* Intervention family — zero, random-noise, permutation, constant
|
|
172
|
+
* QCT classifier with bootstrap confidence intervals
|
|
173
|
+
* Cost-utility analysis: Pareto frontier + QUS + NISQ hardware cost projection
|
|
174
|
+
* Killer figures: QCT plane, convergent validity radar, Pareto plot
|
|
175
|
+
* HTML / JSON / CSV reports
|
|
176
|
+
* Manifest files for reproducibility
|
|
177
|
+
* CLI: `hnep evaluate`, `hnep replay`
|
|
178
|
+
* Four adapters (Functional, Precomputed, JAX/Flax, PyTorch skeleton)
|
|
179
|
+
|
|
180
|
+
## Roadmap
|
|
181
|
+
|
|
182
|
+
See [`docs/HNEP_LIBRARY_ROADMAP.md`](docs/HNEP_LIBRARY_ROADMAP.md) for the version-by-version plan.
|
|
183
|
+
|
|
184
|
+
* **v0.2** — molecular chemistry gallery, atom-level QCI, more probes
|
|
185
|
+
* **v0.3** — Weights & Biases / Hugging Face / GitHub Action integrations
|
|
186
|
+
* **v0.4** — `hnep.dev` web sandbox
|
|
187
|
+
* **v0.5** — HNEP Doctor (AI-powered recommendations)
|
|
188
|
+
* **v1.0** — frozen API, HNEP Arena leaderboard, governance committee
|
|
189
|
+
|
|
190
|
+
## Documentation
|
|
191
|
+
|
|
192
|
+
Locally:
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
pip install "hnep[dev]"
|
|
196
|
+
cd docs_hnep && make html
|
|
197
|
+
open _build/html/index.html
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Or skim the [Sphinx source files](docs_hnep/) directly.
|
|
201
|
+
|
|
202
|
+
## Citing HNEP
|
|
203
|
+
|
|
204
|
+
```bibtex
|
|
205
|
+
@misc{priyanshu2026hnep,
|
|
206
|
+
title = {HNEP: Hybrid Network Evaluation Protocol for Quantum Machine Learning},
|
|
207
|
+
author = {Priyanshu, Pratik},
|
|
208
|
+
year = {2026},
|
|
209
|
+
url = {https://github.com/pratikpriyanshu/hnep},
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
## License
|
|
214
|
+
|
|
215
|
+
MIT. See [LICENSE](LICENSE).
|