edmkit 0.0.1a2__tar.gz → 0.0.3__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 (106) hide show
  1. {edmkit-0.0.1a2 → edmkit-0.0.3}/PKG-INFO +5 -4
  2. {edmkit-0.0.1a2 → edmkit-0.0.3}/pyproject.toml +16 -6
  3. {edmkit-0.0.1a2 → edmkit-0.0.3}/src/edmkit/simplex_projection.py +23 -10
  4. {edmkit-0.0.1a2 → edmkit-0.0.3}/src/edmkit/util.py +2 -2
  5. edmkit-0.0.1a2/.claude/settings.json +0 -13
  6. edmkit-0.0.1a2/.github/workflows/ci.yaml +0 -41
  7. edmkit-0.0.1a2/.github/workflows/release.yaml +0 -61
  8. edmkit-0.0.1a2/.gitignore +0 -12
  9. edmkit-0.0.1a2/.hypothesis/examples/0034576a834117e0/044133a480a9cd85 +0 -0
  10. edmkit-0.0.1a2/.hypothesis/examples/0034576a834117e0/0964f3bb4f032c8c +0 -0
  11. edmkit-0.0.1a2/.hypothesis/examples/0034576a834117e0/1bc81e7a8e7e7bbe +0 -0
  12. edmkit-0.0.1a2/.hypothesis/examples/0034576a834117e0/1cbd358389aea977 +0 -0
  13. edmkit-0.0.1a2/.hypothesis/examples/0034576a834117e0/1e008e88bbcea111 +0 -0
  14. edmkit-0.0.1a2/.hypothesis/examples/0034576a834117e0/1f0548fe4535f985 +0 -0
  15. edmkit-0.0.1a2/.hypothesis/examples/0034576a834117e0/35f88e1faa9f3328 +0 -0
  16. edmkit-0.0.1a2/.hypothesis/examples/0034576a834117e0/367807520711c3cd +0 -0
  17. edmkit-0.0.1a2/.hypothesis/examples/0034576a834117e0/38aa3a747435d725 +0 -0
  18. edmkit-0.0.1a2/.hypothesis/examples/0034576a834117e0/3de528b2ce4dd84a +0 -0
  19. edmkit-0.0.1a2/.hypothesis/examples/0034576a834117e0/3e64f59b937bba6d +0 -0
  20. edmkit-0.0.1a2/.hypothesis/examples/0034576a834117e0/525617db9c75da96 +0 -0
  21. edmkit-0.0.1a2/.hypothesis/examples/0034576a834117e0/57c8909d795f8e62 +0 -0
  22. edmkit-0.0.1a2/.hypothesis/examples/0034576a834117e0/58ea159e481aa3a1 +0 -0
  23. edmkit-0.0.1a2/.hypothesis/examples/0034576a834117e0/5f0509166c83dbdf +0 -0
  24. edmkit-0.0.1a2/.hypothesis/examples/0034576a834117e0/6774887ab59a4432 +0 -0
  25. edmkit-0.0.1a2/.hypothesis/examples/0034576a834117e0/6d32e618ade67baa +0 -0
  26. edmkit-0.0.1a2/.hypothesis/examples/0034576a834117e0/6f38038305c6ed41 +0 -0
  27. edmkit-0.0.1a2/.hypothesis/examples/0034576a834117e0/72b3f55262965df9 +0 -0
  28. edmkit-0.0.1a2/.hypothesis/examples/0034576a834117e0/73c6b6d562d33066 +0 -0
  29. edmkit-0.0.1a2/.hypothesis/examples/0034576a834117e0/75770e80b05e56a7 +0 -0
  30. edmkit-0.0.1a2/.hypothesis/examples/0034576a834117e0/75c0c6ccdb6758f4 +0 -0
  31. edmkit-0.0.1a2/.hypothesis/examples/0034576a834117e0/785b5770443201b7 +0 -0
  32. edmkit-0.0.1a2/.hypothesis/examples/0034576a834117e0/7ce3e424a8ab507e +0 -0
  33. edmkit-0.0.1a2/.hypothesis/examples/0034576a834117e0/7f3f06658346da88 +0 -0
  34. edmkit-0.0.1a2/.hypothesis/examples/0034576a834117e0/9620165cc778cf84 +0 -0
  35. edmkit-0.0.1a2/.hypothesis/examples/0034576a834117e0/a1d22a9e4ce41ee7 +0 -0
  36. edmkit-0.0.1a2/.hypothesis/examples/0034576a834117e0/a468f5bab0a85a25 +0 -0
  37. edmkit-0.0.1a2/.hypothesis/examples/0034576a834117e0/b0462995281909d3 +0 -0
  38. edmkit-0.0.1a2/.hypothesis/examples/0034576a834117e0/b142be48077c179f +0 -0
  39. edmkit-0.0.1a2/.hypothesis/examples/0034576a834117e0/b890364f429a50e6 +0 -0
  40. edmkit-0.0.1a2/.hypothesis/examples/0034576a834117e0/c3c447bf254bcfec +0 -0
  41. edmkit-0.0.1a2/.hypothesis/examples/0034576a834117e0/c507e529c9af7c8b +0 -0
  42. edmkit-0.0.1a2/.hypothesis/examples/0034576a834117e0/ce0c476ef9af71a4 +0 -0
  43. edmkit-0.0.1a2/.hypothesis/examples/0034576a834117e0/ce59c4976acf7ac2 +0 -0
  44. edmkit-0.0.1a2/.hypothesis/examples/0034576a834117e0/d500112e75351aff +0 -0
  45. edmkit-0.0.1a2/.hypothesis/examples/0034576a834117e0/e921351ea8387e26 +0 -0
  46. edmkit-0.0.1a2/.hypothesis/examples/0034576a834117e0/eb0a9649e021b5f3 +0 -0
  47. edmkit-0.0.1a2/.hypothesis/examples/0034576a834117e0/f2bbfb72ee564d9a +0 -0
  48. edmkit-0.0.1a2/.hypothesis/examples/0034576a834117e0/f865d6d4cdf5b640 +0 -0
  49. edmkit-0.0.1a2/.hypothesis/examples/0034576a834117e0/fad02e7ba9c6246b +0 -0
  50. edmkit-0.0.1a2/.hypothesis/examples/0034576a834117e0/fc2136602d452f28 +0 -0
  51. edmkit-0.0.1a2/.hypothesis/examples/015eed87cd1f8935/57c2b394f6a75b5d +0 -0
  52. edmkit-0.0.1a2/.hypothesis/examples/04e6b3400353b141/0034576a834117e0 +0 -0
  53. edmkit-0.0.1a2/.hypothesis/examples/04e6b3400353b141/015eed87cd1f8935 +0 -0
  54. edmkit-0.0.1a2/.hypothesis/examples/04e6b3400353b141/1626189b6bf56f80 +0 -3
  55. edmkit-0.0.1a2/.hypothesis/examples/04e6b3400353b141/d6ffe0a2e4161c9f +0 -3
  56. edmkit-0.0.1a2/.hypothesis/examples/1626189b6bf56f80/80ccd8a8c4824374 +0 -0
  57. edmkit-0.0.1a2/.hypothesis/examples/d6ffe0a2e4161c9f/0578a46e1797298f +0 -0
  58. edmkit-0.0.1a2/.hypothesis/examples/d6ffe0a2e4161c9f/0800fe9f2ab8a679 +0 -0
  59. edmkit-0.0.1a2/.hypothesis/examples/d6ffe0a2e4161c9f/10ea481f27e2e260 +0 -0
  60. edmkit-0.0.1a2/.hypothesis/examples/d6ffe0a2e4161c9f/11034e37d0310d06 +0 -0
  61. edmkit-0.0.1a2/.hypothesis/examples/d6ffe0a2e4161c9f/221dca373a8cef08 +0 -0
  62. edmkit-0.0.1a2/.hypothesis/examples/d6ffe0a2e4161c9f/25c0858c2b8b235a +0 -0
  63. edmkit-0.0.1a2/.hypothesis/examples/d6ffe0a2e4161c9f/417c8597e89210ff +0 -0
  64. edmkit-0.0.1a2/.hypothesis/examples/d6ffe0a2e4161c9f/4443c03f163d115d +0 -0
  65. edmkit-0.0.1a2/.hypothesis/examples/d6ffe0a2e4161c9f/45251b86a5ed87ee +0 -0
  66. edmkit-0.0.1a2/.hypothesis/examples/d6ffe0a2e4161c9f/46004ef293257244 +0 -0
  67. edmkit-0.0.1a2/.hypothesis/examples/d6ffe0a2e4161c9f/4de3f834d4ce14d5 +0 -0
  68. edmkit-0.0.1a2/.hypothesis/examples/d6ffe0a2e4161c9f/5ed0d87b39eeb509 +0 -0
  69. edmkit-0.0.1a2/.hypothesis/examples/d6ffe0a2e4161c9f/6898223221bd2ee8 +0 -0
  70. edmkit-0.0.1a2/.hypothesis/examples/d6ffe0a2e4161c9f/6f29d6906fbc3439 +0 -0
  71. edmkit-0.0.1a2/.hypothesis/examples/d6ffe0a2e4161c9f/a26adfee48d8cb11 +0 -0
  72. edmkit-0.0.1a2/.hypothesis/examples/d6ffe0a2e4161c9f/a8b0c244f138d7ae +0 -0
  73. edmkit-0.0.1a2/.hypothesis/examples/d6ffe0a2e4161c9f/b97e0c0aed942d42 +0 -0
  74. edmkit-0.0.1a2/.hypothesis/examples/d6ffe0a2e4161c9f/bec8b632b57a1753 +0 -0
  75. edmkit-0.0.1a2/.hypothesis/examples/d6ffe0a2e4161c9f/da311781dcf9e316 +0 -0
  76. edmkit-0.0.1a2/.hypothesis/examples/d6ffe0a2e4161c9f/e98a40e2b515c6a9 +0 -0
  77. edmkit-0.0.1a2/.hypothesis/examples/d6ffe0a2e4161c9f/f326016f8c06cb07 +0 -0
  78. edmkit-0.0.1a2/.hypothesis/examples/d6ffe0a2e4161c9f/f9a2590959fe979e +0 -0
  79. edmkit-0.0.1a2/.hypothesis/examples/d6ffe0a2e4161c9f/fab6941330241f35 +0 -0
  80. edmkit-0.0.1a2/.hypothesis/examples/d6ffe0a2e4161c9f/fe901ed8cec27b6a +0 -0
  81. edmkit-0.0.1a2/.python-version +0 -1
  82. edmkit-0.0.1a2/CLAUDE.md +0 -1
  83. edmkit-0.0.1a2/LICENSE +0 -21
  84. edmkit-0.0.1a2/benchmarks/ccm.py +0 -124
  85. edmkit-0.0.1a2/ruff.toml +0 -1
  86. edmkit-0.0.1a2/src/edmkit/__init__.py +0 -5
  87. edmkit-0.0.1a2/tests/__init__.py +0 -0
  88. edmkit-0.0.1a2/tests/conftest.py +0 -115
  89. edmkit-0.0.1a2/tests/helpers.py +0 -11
  90. edmkit-0.0.1a2/tests/smoke_test.py +0 -76
  91. edmkit-0.0.1a2/tests/test_ccm.py +0 -399
  92. edmkit-0.0.1a2/tests/test_e2e.py +0 -69
  93. edmkit-0.0.1a2/tests/test_embedding.py +0 -113
  94. edmkit-0.0.1a2/tests/test_generate.py +0 -229
  95. edmkit-0.0.1a2/tests/test_simplex_projection.py +0 -324
  96. edmkit-0.0.1a2/tests/test_smap.py +0 -433
  97. edmkit-0.0.1a2/tests/test_util.py +0 -270
  98. edmkit-0.0.1a2/uv.lock +0 -296
  99. {edmkit-0.0.1a2 → edmkit-0.0.3}/README.md +0 -0
  100. {edmkit-0.0.1a2 → edmkit-0.0.3}/src/edmkit/ccm.py +0 -0
  101. {edmkit-0.0.1a2 → edmkit-0.0.3}/src/edmkit/embedding.py +0 -0
  102. {edmkit-0.0.1a2 → edmkit-0.0.3}/src/edmkit/generate/__init__.py +0 -0
  103. {edmkit-0.0.1a2 → edmkit-0.0.3}/src/edmkit/generate/double_pendulum.py +0 -0
  104. {edmkit-0.0.1a2 → edmkit-0.0.3}/src/edmkit/generate/lorenz.py +0 -0
  105. {edmkit-0.0.1a2 → edmkit-0.0.3}/src/edmkit/generate/mackey_glass.py +0 -0
  106. {edmkit-0.0.1a2 → edmkit-0.0.3}/src/edmkit/smap.py +0 -0
@@ -1,13 +1,14 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.3
2
2
  Name: edmkit
3
- Version: 0.0.1a2
3
+ Version: 0.0.3
4
4
  Summary: Simple EDM (Empirical Dynamic Modeling) library
5
+ Author: FUJISHIGE TEMMA
5
6
  Author-email: FUJISHIGE TEMMA <tenma.x0@gmail.com>
6
- License-File: LICENSE
7
- Requires-Python: >=3.13
8
7
  Requires-Dist: numpy>=2.4.3
9
8
  Requires-Dist: scipy>=1.17.1
10
9
  Requires-Dist: tinygrad>=0.11.0
10
+ Requires-Dist: usearch>=2.23.0
11
+ Requires-Python: >=3.13
11
12
  Description-Content-Type: text/markdown
12
13
 
13
14
  # edmkit
@@ -1,19 +1,24 @@
1
1
  [project]
2
2
  name = "edmkit"
3
- version = "0.0.1-alpha.2"
3
+ version = "0.0.3"
4
4
  description = "Simple EDM (Empirical Dynamic Modeling) library"
5
5
  authors = [{ name = "FUJISHIGE TEMMA", email = "tenma.x0@gmail.com" }]
6
6
  readme = "README.md"
7
7
  requires-python = ">= 3.13"
8
- dependencies = ["numpy>=2.4.3", "scipy>=1.17.1", "tinygrad>=0.11.0"]
8
+ dependencies = [
9
+ "numpy>=2.4.3",
10
+ "scipy>=1.17.1",
11
+ "tinygrad>=0.11.0",
12
+ "usearch>=2.23.0",
13
+ ]
9
14
 
10
15
  [dependency-groups]
11
16
  dev = [
12
17
  "hypothesis>=6.151.9",
13
18
  "pytest>=9.0.2",
14
- "ruff>=0.15.5",
19
+ "ruff>=0.15.6",
15
20
  "tabulate>=0.10.0",
16
- "ty>=0.0.21",
21
+ "ty>=0.0.23",
17
22
  ]
18
23
 
19
24
  [tool.pytest.ini_options]
@@ -23,6 +28,11 @@ markers = [
23
28
  "gpu: marks tests requiring tinygrad tensor backend (deselect with '-m \"not gpu\"')",
24
29
  ]
25
30
 
31
+
26
32
  [build-system]
27
- requires = ["hatchling"]
28
- build-backend = "hatchling.build"
33
+ requires = ["uv_build>=0.10.9,<0.11.0"]
34
+ build-backend = "uv_build"
35
+
36
+ [tool.uv.build-backend]
37
+ module-name = "edmkit"
38
+ namespace = true
@@ -1,6 +1,7 @@
1
1
  import numpy as np
2
2
  from scipy.spatial import KDTree
3
3
  from tinygrad import Tensor, dtypes
4
+ from usearch.index import Index
4
5
 
5
6
  from edmkit.util import pairwise_distance
6
7
 
@@ -73,6 +74,20 @@ def simplex_projection(
73
74
  return _numpy(X, Y, query_points) if not use_tensor else _tensor(X, Y, query_points)
74
75
 
75
76
 
77
+ def knn(X: np.ndarray, query_points: np.ndarray, k: int) -> tuple[np.ndarray, np.ndarray]:
78
+ N, E = X.shape
79
+ if E >= 15 and N >= 10_000:
80
+ index = Index(ndim=E, metric="l2sq")
81
+ index.add(np.arange(len(X)), np.ascontiguousarray(X, dtype=np.float32))
82
+ matches = index.search(np.ascontiguousarray(query_points, dtype=np.float32), k)
83
+ distances = np.atleast_2d(np.sqrt(np.asarray(matches.distances)))
84
+ indices = np.atleast_2d(np.asarray(matches.keys).astype(np.intp))
85
+ return distances, indices
86
+ else:
87
+ tree = KDTree(X)
88
+ return tree.query(query_points, k=k)
89
+
90
+
76
91
  def _numpy(
77
92
  X: np.ndarray,
78
93
  Y: np.ndarray,
@@ -117,8 +132,7 @@ def _numpy(
117
132
 
118
133
  k: int = X.shape[1] + 1
119
134
 
120
- tree = KDTree(X)
121
- distances, indices = tree.query(query_points, k=k)
135
+ distances, indices = knn(X, query_points, k)
122
136
 
123
137
  Y_neighbors = Y[indices] # (M, k, E')
124
138
 
@@ -146,8 +160,7 @@ def _numpy(
146
160
  distances = np.empty((B, M, k))
147
161
  indices = np.empty((B, M, k), dtype=np.intp)
148
162
  for b in range(B):
149
- tree = KDTree(X[b])
150
- distances[b], indices[b] = tree.query(query_points[b], k=k)
163
+ distances[b], indices[b] = knn(X[b], query_points[b], k)
151
164
 
152
165
  batch_idx = np.arange(B)[:, None, None] # (B, 1, 1)
153
166
  Y_neighbors = Y[batch_idx, indices] # (B, M, k, E')
@@ -219,10 +232,10 @@ def _tensor(
219
232
  Y_neighbors = Y_tensor[indices] # (M, k, E')
220
233
 
221
234
  d_min = distances[:, :1].clip(min_=1e-6) # (M, 1)
222
- weights: Tensor = (-distances / d_min).exp() # (M, k) # type: ignore
235
+ weights: Tensor = (-distances / d_min).exp() # (M, k)
223
236
 
224
- weighted_sum: Tensor = (weights.unsqueeze(-1) * Y_neighbors).sum(axis=1) # (M, E') # type: ignore
225
- predictions: Tensor = weighted_sum / weights.sum(axis=1, keepdim=True) # (M, E') # type: ignore
237
+ weighted_sum: Tensor = (weights.unsqueeze(-1) * Y_neighbors).sum(axis=1) # (M, E')
238
+ predictions: Tensor = weighted_sum / weights.sum(axis=1, keepdim=True) # (M, E')
226
239
 
227
240
  return predictions.numpy().squeeze()
228
241
  # X (B, N, E), Y (B, N, E'), query_points (B, M, E)
@@ -268,10 +281,10 @@ def _tensor(
268
281
  # ---------------------------------------------------------------------------
269
282
 
270
283
  d_min = distances[:, :, :1].clip(min_=1e-6) # (B, M, 1)
271
- weights: Tensor = (-distances / d_min).exp() # (B, M, k) # type: ignore
284
+ weights: Tensor = (-distances / d_min).exp() # (B, M, k)
272
285
 
273
- weighted_sum: Tensor = (weights.unsqueeze(-1) * Y_neighbors).sum(axis=2) # (B, M, E') # type: ignore
274
- predictions: Tensor = weighted_sum / weights.sum(axis=2, keepdim=True) # (B, M, E') # type: ignore
286
+ weighted_sum: Tensor = (weights.unsqueeze(-1) * Y_neighbors).sum(axis=2) # (B, M, E')
287
+ predictions: Tensor = weighted_sum / weights.sum(axis=2, keepdim=True) # (B, M, E')
275
288
 
276
289
  return predictions.numpy()
277
290
  else:
@@ -27,7 +27,7 @@ def pad(As: list[np.ndarray]):
27
27
 
28
28
  B = len(As)
29
29
  L = As[0].shape[0]
30
- max_D = max(t.shape[-1] for t in As) # type: ignore
30
+ max_D = max(t.shape[-1] for t in As)
31
31
 
32
32
  A = np.zeros((B, L, max_D), dtype=As[0].dtype)
33
33
  for i, x in enumerate(As):
@@ -74,7 +74,7 @@ def pairwise_distance(A: Tensor, B: Tensor | None = None) -> Tensor:
74
74
  A_sq = A.pow(2).sum(-1, keepdim=True)
75
75
  B_sq = B.pow(2).sum(-1, keepdim=True).transpose(-1, -2)
76
76
 
77
- D: Tensor = A_sq + B_sq - 2 * A.matmul(B.transpose(-1, -2)) # type: ignore
77
+ D: Tensor = A_sq + B_sq - 2 * A.matmul(B.transpose(-1, -2))
78
78
 
79
79
  return D.clamp(min_=0)
80
80
 
@@ -1,13 +0,0 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "Bash(grep:*)",
5
- "Bash(uv run ruff:*)",
6
- "Bash(uv run ty:*)",
7
- "Bash(uv run pytest:*)",
8
- "Bash(uv run python:*)"
9
- ],
10
- "deny": [],
11
- "ask": []
12
- }
13
- }
@@ -1,41 +0,0 @@
1
- name: Test
2
-
3
- on:
4
- pull_request:
5
- push:
6
- branches:
7
- - main
8
-
9
- jobs:
10
- lint:
11
- name: Lint
12
- runs-on: ubuntu-latest
13
- steps:
14
- - uses: actions/checkout@v6
15
- - uses: astral-sh/setup-uv@v7
16
- - name: Ruff lint
17
- run: uv run ruff check .
18
- - name: Ruff format
19
- run: uv run ruff format --diff .
20
-
21
- type-check:
22
- name: Type check
23
- runs-on: ubuntu-latest
24
- steps:
25
- - uses: actions/checkout@v6
26
- - uses: astral-sh/setup-uv@v7
27
- - name: Ty type check
28
- run: uv run ty check
29
-
30
- test:
31
- name: Test (${{ matrix.os }})
32
- strategy:
33
- matrix:
34
- os: [ubuntu-latest, macos-latest, windows-latest]
35
- runs-on: ${{ matrix.os }}
36
- env:
37
- HYPOTHESIS_PROFILE: ci
38
- steps:
39
- - uses: actions/checkout@v6
40
- - uses: astral-sh/setup-uv@v7
41
- - run: uv run pytest
@@ -1,61 +0,0 @@
1
- name: Release
2
-
3
- on:
4
- push:
5
- branches:
6
- - main
7
-
8
- jobs:
9
- check-version:
10
- name: Check if version is new
11
- runs-on: ubuntu-latest
12
- outputs:
13
- should-release: ${{ steps.check.outputs.should-release }}
14
- version: ${{ steps.check.outputs.version }}
15
- steps:
16
- - name: Checkout
17
- uses: actions/checkout@v6
18
- - name: Install uv
19
- uses: astral-sh/setup-uv@v7
20
- - name: Check PyPI for existing version
21
- id: check
22
- run: |
23
- VERSION=$(uv run python -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
24
- echo "version=$VERSION" >> "$GITHUB_OUTPUT"
25
- STATUS=$(curl -s -o /dev/null -w '%{http_code}' "https://pypi.org/pypi/edmkit/$VERSION/json")
26
- if [ "$STATUS" = "404" ]; then
27
- echo "should-release=true" >> "$GITHUB_OUTPUT"
28
- else
29
- echo "should-release=false" >> "$GITHUB_OUTPUT"
30
- fi
31
-
32
- pypi:
33
- name: Publish to PyPI
34
- needs: check-version
35
- if: needs.check-version.outputs.should-release == 'true'
36
- runs-on: ubuntu-latest
37
- environment:
38
- name: pypi
39
- permissions:
40
- id-token: write
41
- contents: read
42
- attestations: write
43
- steps:
44
- - name: Checkout
45
- uses: actions/checkout@v6
46
- - name: Install uv
47
- uses: astral-sh/setup-uv@v7
48
- - name: Install Python 3.13
49
- run: uv python install 3.13
50
- - name: Build
51
- run: uv build
52
- - name: Smoke test (wheel)
53
- run: uv run --isolated --no-project --with dist/*.whl tests/smoke_test.py
54
- - name: Smoke test (source distribution)
55
- run: uv run --isolated --no-project --with dist/*.tar.gz tests/smoke_test.py
56
- - name: Generate attestations
57
- uses: actions/attest@v4
58
- with:
59
- subject-path: "dist/*"
60
- - name: Publish
61
- run: uv publish --check-url https://pypi.org/simple/
edmkit-0.0.1a2/.gitignore DELETED
@@ -1,12 +0,0 @@
1
- # python generated files
2
- __pycache__/
3
- *.py[oc]
4
- build/
5
- dist/
6
- wheels/
7
- *.egg-info
8
-
9
- # venv
10
- .venv
11
- .hypothesis/*
12
- !.hypothesis/examples/
@@ -1,3 +0,0 @@
1
- ���U������
2
- Ẽh���,z�#So�
3
- P$�p��lj�S
@@ -1,3 +0,0 @@
1
- ���U������
2
- Ẽh���,z�#So�
3
- P$�p��lj�S.secondary
@@ -1 +0,0 @@
1
- 3.13.0
edmkit-0.0.1a2/CLAUDE.md DELETED
@@ -1 +0,0 @@
1
- @AGENTS.md
edmkit-0.0.1a2/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 temma
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.
@@ -1,124 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import time
4
- from dataclasses import dataclass
5
- from functools import partial
6
- from itertools import product
7
-
8
- import numpy as np
9
- from tabulate import tabulate
10
-
11
- from edmkit.ccm import ccm
12
- from edmkit.simplex_projection import simplex_projection
13
-
14
- rng = np.random.default_rng(42)
15
-
16
- N_POINTS = (100, 1000, 10000)
17
- X_DIMS = (1, 10, 100)
18
- Y_DIMS = (1, 10, 100)
19
- N_SAMPLES = (10, 20, 30)
20
- LIBRARY_RATIO = 0.7
21
- LIB_SIZE_STEPS = 4
22
- BATCH_LIMIT = 8
23
-
24
-
25
- @dataclass(frozen=True)
26
- class BenchmarkCase:
27
- n_points: int
28
- x_dim: int
29
- y_dim: int
30
- n_samples: int
31
-
32
- @property
33
- def name(self) -> str:
34
- return f"n{self.n_points}_x{self.x_dim}_y{self.y_dim}_s{self.n_samples}"
35
-
36
- @property
37
- def batch_size(self) -> int:
38
- return min(BATCH_LIMIT, self.n_samples)
39
-
40
-
41
- def iter_cases() -> list[BenchmarkCase]:
42
- return [BenchmarkCase(n, xd, yd, ns) for n, xd, yd, ns in product(N_POINTS, X_DIMS, Y_DIMS, N_SAMPLES)]
43
-
44
-
45
- def synthesize_series(n_points: int, x_dim: int, y_dim: int) -> tuple[np.ndarray, np.ndarray]:
46
- """Generate coupled synthetic data with controllable dimensionality."""
47
-
48
- drivers = rng.standard_normal((n_points, x_dim))
49
- weights = rng.standard_normal((x_dim, max(y_dim, 1)))
50
- responses = drivers @ weights + 0.1 * rng.standard_normal((n_points, max(y_dim, 1)))
51
-
52
- X = drivers if x_dim > 1 else drivers.reshape(n_points, 1)
53
- Y = responses[:, :y_dim] if y_dim > 1 else responses[:, 0]
54
-
55
- return X, Y
56
-
57
-
58
- def compute_lib_sizes(min_size: int, pool_length: int, steps: int) -> np.ndarray:
59
- base = max(min_size, 2)
60
- max_candidate = max(pool_length, base)
61
- if max_candidate == base:
62
- max_candidate = base + max(2, base // 2)
63
-
64
- values = np.linspace(base, max_candidate, num=steps)
65
- lib_sizes = np.unique(np.maximum(values.astype(int), base))
66
- if lib_sizes.size == 0:
67
- lib_sizes = np.array([base])
68
- return lib_sizes
69
-
70
-
71
- def main() -> None:
72
- predict_func = partial(simplex_projection, use_tensor=False)
73
- rows: list[list[str | int]] = []
74
-
75
- for case in iter_cases():
76
- X, Y = synthesize_series(case.n_points, case.x_dim, case.y_dim)
77
- split = max(2, min(case.n_points - 1, int(case.n_points * LIBRARY_RATIO)))
78
- library_pool = np.arange(split)
79
- prediction_pool = np.arange(split, case.n_points)
80
- lib_sizes = compute_lib_sizes(case.x_dim + 1, library_pool.size, LIB_SIZE_STEPS)
81
-
82
- start = time.perf_counter()
83
- ccm(
84
- X=X,
85
- Y=Y,
86
- lib_sizes=lib_sizes,
87
- predict_func=predict_func,
88
- n_samples=case.n_samples,
89
- library_pool=library_pool,
90
- prediction_pool=prediction_pool,
91
- batch_size=case.batch_size,
92
- )
93
- elapsed = time.perf_counter() - start
94
-
95
- rows.append(
96
- [
97
- case.name,
98
- case.n_points,
99
- case.x_dim,
100
- case.y_dim,
101
- case.n_samples,
102
- library_pool.size,
103
- f"{lib_sizes.tolist()}",
104
- case.batch_size,
105
- f"{elapsed:.3f}",
106
- ]
107
- )
108
-
109
- headers = [
110
- "scenario",
111
- "n_points",
112
- "x_dim",
113
- "y_dim",
114
- "n_samples",
115
- "pool",
116
- "lib sizes",
117
- "batch",
118
- "time (s)",
119
- ]
120
- print(tabulate(rows, headers=headers, tablefmt="github"))
121
-
122
-
123
- if __name__ == "__main__":
124
- main()
edmkit-0.0.1a2/ruff.toml DELETED
@@ -1 +0,0 @@
1
- line-length = 150
@@ -1,5 +0,0 @@
1
- # ruff: noqa: F401
2
- from .ccm import bootstrap
3
- from .embedding import lagged_embed
4
- from .simplex_projection import simplex_projection
5
- from .smap import smap
File without changes