believe14 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.
Files changed (152) hide show
  1. believe14-0.1.0/.gitignore +13 -0
  2. believe14-0.1.0/CHANGELOG.md +16 -0
  3. believe14-0.1.0/CITATION.cff +19 -0
  4. believe14-0.1.0/LICENSE +21 -0
  5. believe14-0.1.0/Makefile +82 -0
  6. believe14-0.1.0/PKG-INFO +136 -0
  7. believe14-0.1.0/README.md +76 -0
  8. believe14-0.1.0/RELEASING.md +71 -0
  9. believe14-0.1.0/docs/_ext/catalog.py +196 -0
  10. believe14-0.1.0/docs/_static/custom.css +101 -0
  11. believe14-0.1.0/docs/api.rst +35 -0
  12. believe14-0.1.0/docs/conf.py +127 -0
  13. believe14-0.1.0/docs/contributing.md +36 -0
  14. believe14-0.1.0/docs/examples/_example_data.py +190 -0
  15. believe14-0.1.0/docs/examples/canonical_correlation_analysis.md +38 -0
  16. believe14-0.1.0/docs/examples/classical_mds.md +38 -0
  17. believe14-0.1.0/docs/examples/correlation_dimension.md +37 -0
  18. believe14-0.1.0/docs/examples/danco.md +39 -0
  19. believe14-0.1.0/docs/examples/diffusion_map.md +37 -0
  20. believe14-0.1.0/docs/examples/factor_analysis.md +40 -0
  21. believe14-0.1.0/docs/examples/fast_ica.md +42 -0
  22. believe14-0.1.0/docs/examples/fast_map.md +38 -0
  23. believe14-0.1.0/docs/examples/fisher_score.md +39 -0
  24. believe14-0.1.0/docs/examples/gaussian_random_projection.md +39 -0
  25. believe14-0.1.0/docs/examples/isomap.md +38 -0
  26. believe14-0.1.0/docs/examples/kernel_pca.md +38 -0
  27. believe14-0.1.0/docs/examples/laplacian_eigenmaps.md +37 -0
  28. believe14-0.1.0/docs/examples/levina_bickel_mle.md +37 -0
  29. believe14-0.1.0/docs/examples/linear_discriminant_analysis.md +38 -0
  30. believe14-0.1.0/docs/examples/local_tangent_space_alignment.md +38 -0
  31. believe14-0.1.0/docs/examples/locally_linear_embedding.md +38 -0
  32. believe14-0.1.0/docs/examples/metric_mds.md +44 -0
  33. believe14-0.1.0/docs/examples/mi_ndml.md +37 -0
  34. believe14-0.1.0/docs/examples/pca.md +38 -0
  35. believe14-0.1.0/docs/examples/phate.md +42 -0
  36. believe14-0.1.0/docs/examples/pls_regression.md +39 -0
  37. believe14-0.1.0/docs/examples/probabilistic_pca.md +39 -0
  38. believe14-0.1.0/docs/examples/sammon_mapping.md +45 -0
  39. believe14-0.1.0/docs/examples/sliced_average_variance_estimation.md +38 -0
  40. believe14-0.1.0/docs/examples/sliced_inverse_regression.md +37 -0
  41. believe14-0.1.0/docs/examples/sparse_pca.md +46 -0
  42. believe14-0.1.0/docs/examples/tsne.md +45 -0
  43. believe14-0.1.0/docs/examples/two_nn.md +37 -0
  44. believe14-0.1.0/docs/examples/u_statistic_dimension.md +39 -0
  45. believe14-0.1.0/docs/guides/choosing-a-method.md +77 -0
  46. believe14-0.1.0/docs/guides/distance-and-graph-embeddings.md +73 -0
  47. believe14-0.1.0/docs/guides/intrinsic-dimension.md +77 -0
  48. believe14-0.1.0/docs/guides/linear-latent-representations.md +79 -0
  49. believe14-0.1.0/docs/guides/stress-and-stochastic-embeddings.md +72 -0
  50. believe14-0.1.0/docs/guides/supervised-and-paired-reductions.md +71 -0
  51. believe14-0.1.0/docs/index.md +67 -0
  52. believe14-0.1.0/docs/methods.md +19 -0
  53. believe14-0.1.0/docs/references.bib +307 -0
  54. believe14-0.1.0/docs/references.md +9 -0
  55. believe14-0.1.0/docs/scientific-contract.md +45 -0
  56. believe14-0.1.0/docs/validation/estimation/correlation-dimension.md +28 -0
  57. believe14-0.1.0/docs/validation/estimation/danco.md +46 -0
  58. believe14-0.1.0/docs/validation/estimation/levina-bickel-mle.md +27 -0
  59. believe14-0.1.0/docs/validation/estimation/mind-ml.md +28 -0
  60. believe14-0.1.0/docs/validation/estimation/two-nn.md +26 -0
  61. believe14-0.1.0/docs/validation/estimation/u-statistic-dimension.md +36 -0
  62. believe14-0.1.0/docs/validation/index.md +24 -0
  63. believe14-0.1.0/docs/validation/ledger-template.md +32 -0
  64. believe14-0.1.0/docs/validation/linear/canonical_correlation_analysis.md +16 -0
  65. believe14-0.1.0/docs/validation/linear/factor_analysis.md +20 -0
  66. believe14-0.1.0/docs/validation/linear/fastica.md +18 -0
  67. believe14-0.1.0/docs/validation/linear/fisher_score.md +17 -0
  68. believe14-0.1.0/docs/validation/linear/gaussian_random_projection.md +15 -0
  69. believe14-0.1.0/docs/validation/linear/linear_discriminant_analysis.md +19 -0
  70. believe14-0.1.0/docs/validation/linear/pca.md +14 -0
  71. believe14-0.1.0/docs/validation/linear/pls_regression.md +26 -0
  72. believe14-0.1.0/docs/validation/linear/probabilistic_pca.md +19 -0
  73. believe14-0.1.0/docs/validation/linear/sliced_average_variance_estimation.md +16 -0
  74. believe14-0.1.0/docs/validation/linear/sliced_inverse_regression.md +16 -0
  75. believe14-0.1.0/docs/validation/linear/sparse_pca.md +23 -0
  76. believe14-0.1.0/docs/validation/methods.toml +182 -0
  77. believe14-0.1.0/docs/validation/nonlinear/classical-mds.md +16 -0
  78. believe14-0.1.0/docs/validation/nonlinear/diffusion-map.md +18 -0
  79. believe14-0.1.0/docs/validation/nonlinear/fastmap.md +21 -0
  80. believe14-0.1.0/docs/validation/nonlinear/isomap.md +17 -0
  81. believe14-0.1.0/docs/validation/nonlinear/kernel-pca.md +24 -0
  82. believe14-0.1.0/docs/validation/nonlinear/laplacian-eigenmaps.md +15 -0
  83. believe14-0.1.0/docs/validation/nonlinear/local-tangent-space-alignment.md +16 -0
  84. believe14-0.1.0/docs/validation/nonlinear/locally-linear-embedding.md +17 -0
  85. believe14-0.1.0/docs/validation/nonlinear/metric-mds.md +17 -0
  86. believe14-0.1.0/docs/validation/nonlinear/phate.md +21 -0
  87. believe14-0.1.0/docs/validation/nonlinear/sammon-mapping.md +16 -0
  88. believe14-0.1.0/docs/validation/nonlinear/tsne.md +23 -0
  89. believe14-0.1.0/pyproject.toml +115 -0
  90. believe14-0.1.0/scripts/__init__.py +1 -0
  91. believe14-0.1.0/scripts/artifact_hashes.py +78 -0
  92. believe14-0.1.0/scripts/check_distribution.py +187 -0
  93. believe14-0.1.0/scripts/installed_smoke.py +87 -0
  94. believe14-0.1.0/scripts/release_info.py +90 -0
  95. believe14-0.1.0/scripts/run_in_artifact_env.py +144 -0
  96. believe14-0.1.0/scripts/verify_release.py +185 -0
  97. believe14-0.1.0/src/believe14/__init__.py +36 -0
  98. believe14-0.1.0/src/believe14/_core/__init__.py +1 -0
  99. believe14-0.1.0/src/believe14/_core/diagnostics.py +30 -0
  100. believe14-0.1.0/src/believe14/_core/distances.py +129 -0
  101. believe14-0.1.0/src/believe14/_core/graphs.py +85 -0
  102. believe14-0.1.0/src/believe14/_core/kernels.py +91 -0
  103. believe14-0.1.0/src/believe14/_core/linalg.py +215 -0
  104. believe14-0.1.0/src/believe14/_core/validation.py +153 -0
  105. believe14-0.1.0/src/believe14/api.py +128 -0
  106. believe14-0.1.0/src/believe14/estimation/__init__.py +17 -0
  107. believe14-0.1.0/src/believe14/estimation/_common.py +249 -0
  108. believe14-0.1.0/src/believe14/estimation/_correlation.py +137 -0
  109. believe14-0.1.0/src/believe14/estimation/_danco.py +150 -0
  110. believe14-0.1.0/src/believe14/estimation/_levina_bickel.py +79 -0
  111. believe14-0.1.0/src/believe14/estimation/_mind.py +74 -0
  112. believe14-0.1.0/src/believe14/estimation/_twonn.py +80 -0
  113. believe14-0.1.0/src/believe14/estimation/_ustatistic.py +178 -0
  114. believe14-0.1.0/src/believe14/linear/__init__.py +30 -0
  115. believe14-0.1.0/src/believe14/linear/_common.py +145 -0
  116. believe14-0.1.0/src/believe14/linear/_components.py +372 -0
  117. believe14-0.1.0/src/believe14/linear/_inverse_regression.py +184 -0
  118. believe14-0.1.0/src/believe14/linear/_pca.py +167 -0
  119. believe14-0.1.0/src/believe14/linear/_probabilistic.py +355 -0
  120. believe14-0.1.0/src/believe14/linear/_selection.py +86 -0
  121. believe14-0.1.0/src/believe14/linear/_supervised.py +499 -0
  122. believe14-0.1.0/src/believe14/nonlinear/__init__.py +26 -0
  123. believe14-0.1.0/src/believe14/nonlinear/_common.py +238 -0
  124. believe14-0.1.0/src/believe14/nonlinear/_kernel.py +335 -0
  125. believe14-0.1.0/src/believe14/nonlinear/_manifold.py +396 -0
  126. believe14-0.1.0/src/believe14/nonlinear/_mds.py +517 -0
  127. believe14-0.1.0/src/believe14/nonlinear/_stochastic.py +456 -0
  128. believe14-0.1.0/src/believe14/py.typed +1 -0
  129. believe14-0.1.0/src/believe14/registry.py +434 -0
  130. believe14-0.1.0/tests/test_contracts.py +252 -0
  131. believe14-0.1.0/tests/test_core.py +199 -0
  132. believe14-0.1.0/tests/test_documentation.py +101 -0
  133. believe14-0.1.0/tests/test_estimation_boundaries.py +238 -0
  134. believe14-0.1.0/tests/test_estimation_formulas.py +225 -0
  135. believe14-0.1.0/tests/test_estimation_properties.py +181 -0
  136. believe14-0.1.0/tests/test_examples.py +118 -0
  137. believe14-0.1.0/tests/test_linear.py +405 -0
  138. believe14-0.1.0/tests/test_linear_validation.py +259 -0
  139. believe14-0.1.0/tests/test_nonlinear_boundaries.py +441 -0
  140. believe14-0.1.0/tests/test_nonlinear_iterative.py +134 -0
  141. believe14-0.1.0/tests/test_nonlinear_mds.py +163 -0
  142. believe14-0.1.0/tests/test_nonlinear_spectral.py +151 -0
  143. believe14-0.1.0/tests/test_numerical_stability.py +168 -0
  144. believe14-0.1.0/tests/test_registry.py +176 -0
  145. believe14-0.1.0/tests/test_release_tooling.py +212 -0
  146. believe14-0.1.0/tests/test_research_audits.py +74 -0
  147. believe14-0.1.0/tests/test_sklearn_compatibility.py +57 -0
  148. believe14-0.1.0/tools/__init__.py +1 -0
  149. believe14-0.1.0/tools/check_docs_html.py +359 -0
  150. believe14-0.1.0/tools/release_audit.py +654 -0
  151. believe14-0.1.0/tools/wheel_smoke.py +78 -0
  152. believe14-0.1.0/uv.lock +2494 -0
@@ -0,0 +1,13 @@
1
+ .DS_Store
2
+ .coverage
3
+ .mypy_cache/
4
+ .pytest_cache/
5
+ .ruff_cache/
6
+ .venv/
7
+ __pycache__/
8
+ build/
9
+ dist/
10
+ docs/_build/
11
+ htmlcov/
12
+ *.egg-info/
13
+ *.py[cod]
@@ -0,0 +1,16 @@
1
+ # Changelog
2
+
3
+ ## [0.1.0]
4
+
5
+ - Initial release with 12 linear reducers/selectors, 12 nonlinear embeddings,
6
+ and 6 intrinsic-dimension estimators.
7
+ - Added paper-audit ledgers, independent numerical validation, and a public
8
+ capability registry.
9
+ - Added an executable method card for every public estimator and six
10
+ task-oriented guides built against the installed wheel.
11
+ - Added installed wheel and sdist checks across Python 3.12–3.14 on Linux,
12
+ macOS, and Windows.
13
+ - Added an immutable-artifact release path through TestPyPI, PyPI, GitHub
14
+ Releases, and GitHub Pages using trusted publishing.
15
+
16
+ [0.1.0]: https://github.com/kisungyou/believe14/releases/tag/v0.1.0
@@ -0,0 +1,19 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use believe14, cite the software and the primary papers for the methods used."
3
+ title: "believe14: paper-first dimensionality reduction and estimation"
4
+ type: software
5
+ abstract: >-
6
+ A paper-first Python library of dimensionality-reduction and
7
+ intrinsic-dimension-estimation methods with explicit numerical contracts.
8
+ authors:
9
+ - family-names: You
10
+ given-names: Kisung
11
+ version: 0.1.0
12
+ license: MIT
13
+ repository-code: "https://github.com/kisungyou/believe14"
14
+ url: "https://kisungyou.github.io/believe14/"
15
+ keywords:
16
+ - dimensionality reduction
17
+ - manifold learning
18
+ - intrinsic dimension
19
+ - machine learning
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Kisung You
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.
@@ -0,0 +1,82 @@
1
+ PYTHON ?= $(if $(wildcard .venv/bin/python),.venv/bin/python,python3)
2
+ UV ?= uv
3
+ UV_CACHE_ENV = $(if $(UV_CACHE_DIR),UV_CACHE_DIR=$(UV_CACHE_DIR),)
4
+ DIST_DIR ?= dist
5
+ DOCS_BUILD_DIR ?= docs/_build/html
6
+ AUDIT_OUTPUT ?= build/release-audit.json
7
+
8
+ VERSION := $(shell $(PYTHON) -m scripts.release_info --field version)
9
+ TAG := $(shell $(PYTHON) -m scripts.release_info --field tag)
10
+ WHEEL := $(DIST_DIR)/$(shell $(PYTHON) -m scripts.release_info --field wheel)
11
+ SDIST := $(DIST_DIR)/$(shell $(PYTHON) -m scripts.release_info --field sdist)
12
+ ARTIFACT_ENV := $(PYTHON) -m scripts.run_in_artifact_env --installer uv
13
+
14
+ .PHONY: help quality test research build package-check package-check-built \
15
+ docs docs-built examples examples-or-docs metadata-check verify-release \
16
+ verify-tag release-audit release-audit-built release-check
17
+
18
+ help:
19
+ @echo "believe14 $(VERSION) development commands"
20
+ @echo " quality formatting, lint, and strict typing checks"
21
+ @echo " test deterministic tests with branch coverage"
22
+ @echo " examples executable documentation built from the wheel"
23
+ @echo " package-check wheel/sdist metadata and installed smoke checks"
24
+ @echo " release-check every local release gate"
25
+
26
+ quality:
27
+ $(PYTHON) -m ruff format --check .
28
+ $(PYTHON) -m ruff check .
29
+ $(PYTHON) -m mypy
30
+
31
+ test:
32
+ $(PYTHON) -m pytest --cov=believe14 --cov-report=term-missing --cov-fail-under=90
33
+
34
+ research:
35
+ $(PYTHON) -m pytest -m research
36
+
37
+ build:
38
+ $(UV_CACHE_ENV) $(UV) build --offline --no-create-gitignore --out-dir $(DIST_DIR)
39
+
40
+ package-check: build package-check-built
41
+
42
+ package-check-built:
43
+ $(PYTHON) -m twine check --strict $(WHEEL) $(SDIST)
44
+ $(PYTHON) -m scripts.check_distribution --dist-dir $(DIST_DIR)
45
+ $(PYTHON) -m scripts.artifact_hashes write --manifest $(DIST_DIR)/SHA256SUMS $(WHEEL) $(SDIST)
46
+ $(ARTIFACT_ENV) --artifact $(WHEEL) -- {python} -I scripts/installed_smoke.py --expected-version $(VERSION)
47
+ $(ARTIFACT_ENV) --artifact $(SDIST) -- {python} -I scripts/installed_smoke.py --expected-version $(VERSION)
48
+
49
+ docs: build docs-built
50
+
51
+ docs-built:
52
+ BELIEVE14_DOCS_REQUIRE_WHEEL=1 $(ARTIFACT_ENV) --artifact $(WHEEL) -- {python} -I -m sphinx -W -b html docs $(DOCS_BUILD_DIR)
53
+ $(ARTIFACT_ENV) --artifact $(WHEEL) -- {python} -I tools/check_docs_html.py $(DOCS_BUILD_DIR)
54
+
55
+ examples: docs
56
+
57
+ examples-or-docs: docs
58
+
59
+ metadata-check:
60
+ $(PYTHON) -m scripts.verify_release --metadata-only
61
+
62
+ verify-release:
63
+ $(PYTHON) -m scripts.verify_release --check-clean --check-remote
64
+
65
+ verify-tag:
66
+ $(PYTHON) -m scripts.verify_release --check-clean --check-remote --require-tag --expected-tag $(TAG)
67
+
68
+ release-audit: package-check release-audit-built
69
+
70
+ release-audit-built:
71
+ $(PYTHON) -c "from pathlib import Path; Path('$(AUDIT_OUTPUT)').parent.mkdir(parents=True, exist_ok=True)"
72
+ $(ARTIFACT_ENV) --artifact $(WHEEL) -- {python} -I -W error tools/release_audit.py --output $(AUDIT_OUTPUT) --artifact $(WHEEL) --artifact $(SDIST)
73
+
74
+ release-check:
75
+ $(MAKE) verify-release
76
+ $(MAKE) quality
77
+ $(MAKE) test
78
+ $(MAKE) research
79
+ $(MAKE) build
80
+ $(MAKE) package-check-built
81
+ $(MAKE) docs-built
82
+ $(MAKE) release-audit-built
@@ -0,0 +1,136 @@
1
+ Metadata-Version: 2.5
2
+ Name: believe14
3
+ Version: 0.1.0
4
+ Summary: Paper-first dimensionality reduction and intrinsic-dimension estimation
5
+ Project-URL: Repository, https://github.com/kisungyou/believe14
6
+ Project-URL: Issues, https://github.com/kisungyou/believe14/issues
7
+ Author: Kisung You
8
+ License: MIT License
9
+
10
+ Copyright (c) 2026 Kisung You
11
+
12
+ Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ of this software and associated documentation files (the "Software"), to deal
14
+ in the Software without restriction, including without limitation the rights
15
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ copies of the Software, and to permit persons to whom the Software is
17
+ furnished to do so, subject to the following conditions:
18
+
19
+ The above copyright notice and this permission notice shall be included in all
20
+ copies or substantial portions of the Software.
21
+
22
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ SOFTWARE.
29
+ License-File: LICENSE
30
+ Keywords: dimensionality reduction,intrinsic dimension,machine learning,manifold learning
31
+ Classifier: Development Status :: 3 - Alpha
32
+ Classifier: Intended Audience :: Science/Research
33
+ Classifier: License :: OSI Approved :: MIT License
34
+ Classifier: Programming Language :: Python :: 3
35
+ Classifier: Programming Language :: Python :: 3.12
36
+ Classifier: Programming Language :: Python :: 3.13
37
+ Classifier: Programming Language :: Python :: 3.14
38
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
39
+ Requires-Python: >=3.12
40
+ Requires-Dist: numpy>=2.5.1
41
+ Requires-Dist: scikit-learn>=1.9.0
42
+ Requires-Dist: scipy>=1.18.0
43
+ Provides-Extra: dev
44
+ Requires-Dist: build>=1.3; extra == 'dev'
45
+ Requires-Dist: mypy>=1.17; extra == 'dev'
46
+ Requires-Dist: pytest-cov>=6.2; extra == 'dev'
47
+ Requires-Dist: pytest>=8.4; extra == 'dev'
48
+ Requires-Dist: ruff>=0.12; extra == 'dev'
49
+ Provides-Extra: docs
50
+ Requires-Dist: matplotlib>=3.10; extra == 'docs'
51
+ Requires-Dist: myst-nb>=1.3; extra == 'docs'
52
+ Requires-Dist: pydata-sphinx-theme>=0.16; extra == 'docs'
53
+ Requires-Dist: sphinx-copybutton>=0.5; extra == 'docs'
54
+ Requires-Dist: sphinx>=8.2; extra == 'docs'
55
+ Requires-Dist: sphinxcontrib-bibtex>=2.6; extra == 'docs'
56
+ Provides-Extra: test
57
+ Requires-Dist: pytest-cov>=6.2; extra == 'test'
58
+ Requires-Dist: pytest>=8.4; extra == 'test'
59
+ Description-Content-Type: text/markdown
60
+
61
+ # believe14
62
+
63
+ `believe14` is a paper-first Python library for dimensionality reduction and
64
+ intrinsic-dimension estimation. Version 0.1.0 contains 30 independently
65
+ implemented and validated methods organized into three public families:
66
+ `believe14.linear`, `believe14.nonlinear`, and `believe14.estimation`.
67
+
68
+ The package follows the scikit-learn estimator protocol while keeping its
69
+ scientific implementations independent. NumPy and SciPy provide numerical
70
+ primitives; scikit-learn provides estimator interoperability and validation.
71
+
72
+ ## Installation
73
+
74
+ ```bash
75
+ python -m pip install believe14
76
+ ```
77
+
78
+ Python 3.12 or newer is required.
79
+
80
+ ## Example
81
+
82
+ ```python
83
+ from believe14.linear import PCA
84
+
85
+ model = PCA(n_components=2)
86
+ embedding = model.fit_transform(X)
87
+ ```
88
+
89
+ Each method has a validation ledger under `docs/validation/` recording its
90
+ normative equations, numerical conventions, and independent evidence.
91
+
92
+ ## Documentation and method examples
93
+
94
+ The documentation contains an executable method card for every public class,
95
+ six task-oriented guides, and a registry-generated coverage table. Examples use
96
+ small deterministic datasets and run without network access. They distinguish
97
+ inductive reducers with a justified `transform` from transductive embeddings
98
+ that intentionally expose no out-of-sample operation.
99
+
100
+ Build the examples from the packaged wheel, rather than the source checkout:
101
+
102
+ ```bash
103
+ make examples
104
+ ```
105
+
106
+ ## Development and validation
107
+
108
+ Create the locked development environment and add Twine, then use the same
109
+ commands as continuous integration. The local build uses uv's offline artifact
110
+ cache so documentation examples never fetch data or packages while executing.
111
+
112
+ ```bash
113
+ uv sync --extra dev --extra docs
114
+ uv pip install twine
115
+ make quality
116
+ make test
117
+ make package-check
118
+ ```
119
+
120
+ `make release-check` adds executable documentation, research checks, clean-tree
121
+ and repository provenance checks, installed wheel/sdist tests, and the complete
122
+ scientific release audit. The supported release matrix is Python 3.12–3.14 on
123
+ Linux, macOS, and Windows. See [RELEASING.md](RELEASING.md) for the trusted
124
+ TestPyPI, PyPI, GitHub Release, and documentation deployment process.
125
+
126
+ ## Release trajectory
127
+
128
+ - **0.1.1:** correctness, packaging, and documentation fixes only.
129
+ - **0.2.0:** supervised and feature-selection expansion.
130
+ - **0.3.0:** nonlinear and landmark-method expansion.
131
+ - **0.4.0:** intrinsic-dimension estimation expansion.
132
+
133
+ New methods must land as complete vertical slices: paper ledger, literal oracle,
134
+ implementation, normal tests, method card, and guide integration. Performance
135
+ work is profiling-led, and the readable NumPy/SciPy path remains the permanent
136
+ reference implementation.
@@ -0,0 +1,76 @@
1
+ # believe14
2
+
3
+ `believe14` is a paper-first Python library for dimensionality reduction and
4
+ intrinsic-dimension estimation. Version 0.1.0 contains 30 independently
5
+ implemented and validated methods organized into three public families:
6
+ `believe14.linear`, `believe14.nonlinear`, and `believe14.estimation`.
7
+
8
+ The package follows the scikit-learn estimator protocol while keeping its
9
+ scientific implementations independent. NumPy and SciPy provide numerical
10
+ primitives; scikit-learn provides estimator interoperability and validation.
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ python -m pip install believe14
16
+ ```
17
+
18
+ Python 3.12 or newer is required.
19
+
20
+ ## Example
21
+
22
+ ```python
23
+ from believe14.linear import PCA
24
+
25
+ model = PCA(n_components=2)
26
+ embedding = model.fit_transform(X)
27
+ ```
28
+
29
+ Each method has a validation ledger under `docs/validation/` recording its
30
+ normative equations, numerical conventions, and independent evidence.
31
+
32
+ ## Documentation and method examples
33
+
34
+ The documentation contains an executable method card for every public class,
35
+ six task-oriented guides, and a registry-generated coverage table. Examples use
36
+ small deterministic datasets and run without network access. They distinguish
37
+ inductive reducers with a justified `transform` from transductive embeddings
38
+ that intentionally expose no out-of-sample operation.
39
+
40
+ Build the examples from the packaged wheel, rather than the source checkout:
41
+
42
+ ```bash
43
+ make examples
44
+ ```
45
+
46
+ ## Development and validation
47
+
48
+ Create the locked development environment and add Twine, then use the same
49
+ commands as continuous integration. The local build uses uv's offline artifact
50
+ cache so documentation examples never fetch data or packages while executing.
51
+
52
+ ```bash
53
+ uv sync --extra dev --extra docs
54
+ uv pip install twine
55
+ make quality
56
+ make test
57
+ make package-check
58
+ ```
59
+
60
+ `make release-check` adds executable documentation, research checks, clean-tree
61
+ and repository provenance checks, installed wheel/sdist tests, and the complete
62
+ scientific release audit. The supported release matrix is Python 3.12–3.14 on
63
+ Linux, macOS, and Windows. See [RELEASING.md](RELEASING.md) for the trusted
64
+ TestPyPI, PyPI, GitHub Release, and documentation deployment process.
65
+
66
+ ## Release trajectory
67
+
68
+ - **0.1.1:** correctness, packaging, and documentation fixes only.
69
+ - **0.2.0:** supervised and feature-selection expansion.
70
+ - **0.3.0:** nonlinear and landmark-method expansion.
71
+ - **0.4.0:** intrinsic-dimension estimation expansion.
72
+
73
+ New methods must land as complete vertical slices: paper ledger, literal oracle,
74
+ implementation, normal tests, method card, and guide integration. Performance
75
+ work is profiling-led, and the readable NumPy/SciPy path remains the permanent
76
+ reference implementation.
@@ -0,0 +1,71 @@
1
+ # Releasing believe14
2
+
3
+ The public artifacts are built once from a clean annotated tag. The same wheel
4
+ and source archive are checked on all supported platforms, rehearsed on
5
+ TestPyPI, uploaded unchanged to PyPI, and attached to the GitHub Release.
6
+
7
+ ## One-time repository setup
8
+
9
+ 1. Create `kisungyou/believe14` on GitHub, set `main` as its default protected
10
+ branch, and enable GitHub Actions as the Pages source.
11
+ 2. Add GitHub environments named `testpypi`, `pypi`, and `github-pages`.
12
+ Protection rules and required reviewers may be added to all three.
13
+ 3. Register `.github/workflows/publish.yml` as a trusted publisher for the
14
+ `testpypi` environment on TestPyPI and the `pypi` environment on PyPI. No API
15
+ token or repository secret is used.
16
+ 4. Require the CI workflow before merging to `main`. The workflow exercises
17
+ Python 3.12–3.14 on Linux, macOS, and Windows and deploys documentation only
18
+ after every required job passes.
19
+
20
+ ## Prepare 0.1.0
21
+
22
+ Use the locked development environment containing the `dev` and `docs` extras
23
+ plus Twine. The local release command intentionally fails when the Git tree is
24
+ dirty or `origin` does not match the repository URL in `pyproject.toml`.
25
+
26
+ ```bash
27
+ uv sync --extra dev --extra docs
28
+ uv pip install twine
29
+ make release-check
30
+ ```
31
+
32
+ Review `dist/SHA256SUMS` and `build/release-audit.json`. Confirm that the release
33
+ gate in the audit is `passed: true`. Commit only source files; `dist/`, `build/`,
34
+ and generated documentation are ignored and must never be committed.
35
+
36
+ ## Tag and publish
37
+
38
+ Create the release tag only from a clean, passing `main` commit. It must be an
39
+ annotated tag whose name exactly matches `v` plus the numeric project version.
40
+
41
+ ```bash
42
+ git switch main
43
+ git pull --ff-only
44
+ make release-check
45
+ git tag -a v0.1.0 -m "believe14 0.1.0"
46
+ make verify-tag
47
+ git push origin main
48
+ git push origin v0.1.0
49
+ ```
50
+
51
+ The tag starts the publish workflow. That workflow:
52
+
53
+ 1. verifies the clean tag, metadata, examples, tests, and scientific audit;
54
+ 2. builds exactly one wheel and one sdist and records their SHA-256 digests;
55
+ 3. smoke-tests wheel and sdist installations on every supported Python/OS pair;
56
+ 4. uploads those artifacts to TestPyPI through trusted publishing and installs
57
+ the TestPyPI copy as a rehearsal;
58
+ 5. uploads the original, checksum-verified artifacts to PyPI;
59
+ 6. deploys documentation built against the wheel from the tagged commit; and
60
+ 7. creates the GitHub Release with the same two files and `SHA256SUMS`.
61
+
62
+ Do not rebuild, edit, or upload artifacts manually between these stages. If a
63
+ stage fails before PyPI publication, fix the source and create a new version;
64
+ released filenames are immutable. A duplicate TestPyPI version is also treated
65
+ as a failure rather than silently skipped.
66
+
67
+ ## After publication
68
+
69
+ Verify the PyPI project page, the GitHub Release checksums, and the deployed
70
+ documentation. Installation compatibility or correctness regressions go into
71
+ 0.1.1; new methods belong to the planned 0.2.0 or later catalog expansions.
@@ -0,0 +1,196 @@
1
+ """Registry-backed Sphinx directives for the believe14 documentation."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import re
6
+ from dataclasses import dataclass
7
+ from pathlib import Path
8
+
9
+ from docutils import nodes
10
+ from docutils.parsers.rst import Directive
11
+
12
+ from believe14.api import Capability, EstimatorInfo
13
+ from believe14.registry import list_estimators
14
+
15
+ _FRONT_MATTER = re.compile(r"\A---\s*\n(?P<body>.*?)\n---\s*\n", re.DOTALL)
16
+ _FIELD = re.compile(r"^(?P<key>[A-Za-z][A-Za-z0-9_-]*):\s*(?P<value>.*?)\s*$")
17
+
18
+
19
+ @dataclass(frozen=True, slots=True)
20
+ class ExampleCard:
21
+ """Metadata read from one executable method card."""
22
+
23
+ estimator: str
24
+ family: str
25
+ path: Path
26
+
27
+ @property
28
+ def docname(self) -> str:
29
+ return f"examples/{self.path.stem}"
30
+
31
+
32
+ def _front_matter(path: Path) -> dict[str, str]:
33
+ text = path.read_text(encoding="utf-8")
34
+ match = _FRONT_MATTER.match(text)
35
+ if match is None:
36
+ raise ValueError(f"Method card has no YAML front matter: {path}")
37
+ fields: dict[str, str] = {}
38
+ for line in match.group("body").splitlines():
39
+ field = _FIELD.match(line)
40
+ if field is not None:
41
+ fields[field.group("key")] = field.group("value").strip("'\"")
42
+ return fields
43
+
44
+
45
+ def discover_example_cards(docs_root: Path) -> tuple[ExampleCard, ...]:
46
+ """Read and validate the complete registry-to-method-card mapping."""
47
+
48
+ examples_root = docs_root / "examples"
49
+ if not examples_root.is_dir():
50
+ raise ValueError(f"Missing executable method-card directory: {examples_root}")
51
+
52
+ cards: list[ExampleCard] = []
53
+ for path in sorted(examples_root.glob("*.md")):
54
+ fields = _front_matter(path)
55
+ estimator = fields.get("believe14_estimator")
56
+ family = fields.get("believe14_family")
57
+ if estimator is None or family is None:
58
+ raise ValueError(
59
+ "Method-card front matter must define believe14_estimator and "
60
+ f"believe14_family: {path}"
61
+ )
62
+ cards.append(ExampleCard(estimator=estimator, family=family, path=path))
63
+
64
+ expected = {info.name: info for info in list_estimators()}
65
+ by_name: dict[str, ExampleCard] = {}
66
+ duplicates: list[str] = []
67
+ for card in cards:
68
+ if card.estimator in by_name:
69
+ duplicates.append(card.estimator)
70
+ by_name[card.estimator] = card
71
+
72
+ missing = sorted(expected.keys() - by_name.keys())
73
+ unexpected = sorted(by_name.keys() - expected.keys())
74
+ mismatched = sorted(
75
+ name
76
+ for name in expected.keys() & by_name.keys()
77
+ if by_name[name].family != expected[name].family
78
+ )
79
+ if duplicates or missing or unexpected or mismatched or len(cards) != 30:
80
+ raise ValueError(
81
+ "Executable method-card coverage does not match the public registry: "
82
+ f"count={len(cards)}, duplicates={sorted(set(duplicates))}, "
83
+ f"missing={missing}, unexpected={unexpected}, "
84
+ f"family_mismatches={mismatched}"
85
+ )
86
+ return tuple(by_name[info.name] for info in list_estimators())
87
+
88
+
89
+ def _entry(value: str | nodes.Node) -> nodes.entry:
90
+ entry = nodes.entry()
91
+ if isinstance(value, str):
92
+ entry += nodes.paragraph(text=value)
93
+ else:
94
+ paragraph = nodes.paragraph()
95
+ paragraph += value
96
+ entry += paragraph
97
+ return entry
98
+
99
+
100
+ def _table(column_count: int, css_class: str) -> tuple[nodes.table, nodes.tbody]:
101
+ table = nodes.table(classes=[css_class])
102
+ group = nodes.tgroup(cols=column_count)
103
+ table += group
104
+ for _ in range(column_count):
105
+ group += nodes.colspec(colwidth=1)
106
+ body = nodes.tbody()
107
+ group += body
108
+ return table, body
109
+
110
+
111
+ def _add_header(table: nodes.table, labels: tuple[str, ...]) -> None:
112
+ group = table[0]
113
+ head = nodes.thead()
114
+ group.insert(len(labels), head)
115
+ row = nodes.row()
116
+ head += row
117
+ for label in labels:
118
+ row += _entry(label)
119
+
120
+
121
+ def _mode(info: EstimatorInfo) -> str:
122
+ if info.family == "estimation":
123
+ return "dimension estimate"
124
+ if Capability.TRANSFORM in info.capabilities:
125
+ assert info.out_of_sample is not None
126
+ return f"inductive ({info.out_of_sample})"
127
+ return "transductive"
128
+
129
+
130
+ class CatalogDirective(Directive):
131
+ """Render one believe14 family as a registry-backed table."""
132
+
133
+ required_arguments = 1
134
+ has_content = False
135
+
136
+ def run(self): # type: ignore[no-untyped-def]
137
+ family = self.arguments[0]
138
+ if family not in {"linear", "nonlinear", "estimation"}:
139
+ raise self.error(f"Unknown believe14 family: {family}")
140
+ table, body = _table(5, "believe14-catalog")
141
+ _add_header(
142
+ table,
143
+ ("Estimator", "Approaches", "Supervision", "Out of sample", "Cost"),
144
+ )
145
+ for info in list_estimators(family=family):
146
+ row = nodes.row()
147
+ values = (
148
+ info.name,
149
+ ", ".join(sorted(info.approaches)),
150
+ info.supervision,
151
+ info.out_of_sample or "transductive / not applicable",
152
+ info.complexity,
153
+ )
154
+ for value in values:
155
+ row += _entry(value)
156
+ body += row
157
+ return [table]
158
+
159
+
160
+ class ExampleCoverageDirective(Directive):
161
+ """Render the complete registry-to-executable-card coverage table."""
162
+
163
+ has_content = False
164
+
165
+ def run(self): # type: ignore[no-untyped-def]
166
+ environment = self.state.document.settings.env
167
+ try:
168
+ cards = discover_example_cards(Path(environment.srcdir))
169
+ except ValueError as error:
170
+ raise self.error(str(error)) from error
171
+
172
+ builder = environment.app.builder
173
+ table, body = _table(5, "believe14-example-coverage")
174
+ _add_header(table, ("Estimator", "Family", "Supervision", "Mode", "Card"))
175
+ for info, card in zip(list_estimators(), cards, strict=True):
176
+ row = nodes.row(ids=[f"believe14-example-{info.name}"])
177
+ target = builder.get_relative_uri(environment.docname, card.docname)
178
+ link = nodes.reference("", "open example", refuri=target, internal=True)
179
+ for value in (info.name, info.family, info.supervision, _mode(info), link):
180
+ row += _entry(value)
181
+ body += row
182
+ return [table]
183
+
184
+
185
+ def _validate_examples(app) -> None: # type: ignore[no-untyped-def]
186
+ try:
187
+ discover_example_cards(Path(app.srcdir))
188
+ except ValueError as error:
189
+ raise RuntimeError(str(error)) from error
190
+
191
+
192
+ def setup(app): # type: ignore[no-untyped-def]
193
+ app.add_directive("believe14-catalog", CatalogDirective)
194
+ app.add_directive("believe14-example-coverage", ExampleCoverageDirective)
195
+ app.connect("builder-inited", _validate_examples)
196
+ return {"parallel_read_safe": True, "parallel_write_safe": True}