edmkit 0.0.9__tar.gz → 0.0.11__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.
- {edmkit-0.0.9 → edmkit-0.0.11}/PKG-INFO +4 -4
- {edmkit-0.0.9 → edmkit-0.0.11}/pyproject.toml +4 -4
- {edmkit-0.0.9 → edmkit-0.0.11}/src/edmkit/simplex_projection/loo.py +5 -4
- {edmkit-0.0.9 → edmkit-0.0.11}/src/edmkit/simplex_projection/simplex_projection.py +8 -5
- {edmkit-0.0.9 → edmkit-0.0.11}/src/edmkit/util.py +7 -1
- {edmkit-0.0.9 → edmkit-0.0.11}/README.md +0 -0
- {edmkit-0.0.9 → edmkit-0.0.11}/src/edmkit/ccm.py +0 -0
- {edmkit-0.0.9 → edmkit-0.0.11}/src/edmkit/embedding.py +0 -0
- {edmkit-0.0.9 → edmkit-0.0.11}/src/edmkit/generate/__init__.py +0 -0
- {edmkit-0.0.9 → edmkit-0.0.11}/src/edmkit/generate/double_pendulum.py +0 -0
- {edmkit-0.0.9 → edmkit-0.0.11}/src/edmkit/generate/lorenz.py +0 -0
- {edmkit-0.0.9 → edmkit-0.0.11}/src/edmkit/generate/mackey_glass.py +0 -0
- {edmkit-0.0.9 → edmkit-0.0.11}/src/edmkit/metrics.py +0 -0
- {edmkit-0.0.9 → edmkit-0.0.11}/src/edmkit/simplex_projection/__init__.py +0 -0
- {edmkit-0.0.9 → edmkit-0.0.11}/src/edmkit/simplex_projection/knn.py +0 -0
- {edmkit-0.0.9 → edmkit-0.0.11}/src/edmkit/smap.py +0 -0
- {edmkit-0.0.9 → edmkit-0.0.11}/src/edmkit/splits.py +0 -0
- {edmkit-0.0.9 → edmkit-0.0.11}/src/edmkit/types.py +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: edmkit
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.11
|
|
4
4
|
Summary: Simple EDM (Empirical Dynamic Modeling) library
|
|
5
5
|
Author: FUJISHIGE TEMMA
|
|
6
6
|
Author-email: FUJISHIGE TEMMA <tenma.x0@gmail.com>
|
|
7
|
-
Requires-Dist: kdtree-rs>=0.
|
|
8
|
-
Requires-Dist: numpy>=2.4.
|
|
7
|
+
Requires-Dist: kdtree-rs>=0.3.0
|
|
8
|
+
Requires-Dist: numpy>=2.4.6
|
|
9
9
|
Requires-Dist: scipy>=1.17.1
|
|
10
|
-
Requires-Dist: tinygrad>=0.
|
|
10
|
+
Requires-Dist: tinygrad>=0.13.0
|
|
11
11
|
Requires-Python: >=3.13
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "edmkit"
|
|
3
|
-
version = "0.0.
|
|
3
|
+
version = "0.0.11"
|
|
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
8
|
dependencies = [
|
|
9
|
-
"kdtree-rs>=0.
|
|
10
|
-
"numpy>=2.4.
|
|
9
|
+
"kdtree-rs>=0.3.0",
|
|
10
|
+
"numpy>=2.4.6",
|
|
11
11
|
"scipy>=1.17.1",
|
|
12
|
-
"tinygrad>=0.
|
|
12
|
+
"tinygrad>=0.13.0",
|
|
13
13
|
]
|
|
14
14
|
|
|
15
15
|
[dependency-groups]
|
|
@@ -71,8 +71,8 @@ def loo(
|
|
|
71
71
|
d_min = np.fmax(distances.min(axis=1, keepdims=True), 1e-6) # (N, 1)
|
|
72
72
|
weights = np.exp(-distances / d_min) # (N, k)
|
|
73
73
|
|
|
74
|
-
weighted_sum = np.
|
|
75
|
-
predictions = weighted_sum /
|
|
74
|
+
weighted_sum = np.matmul(weights[:, None, :], Y_neighbors).squeeze(-2) # (N, E')
|
|
75
|
+
predictions = weighted_sum / weights.sum(axis=1, keepdims=True)
|
|
76
76
|
|
|
77
77
|
return predictions.squeeze() # (N,) or (N, E')
|
|
78
78
|
# X (B, N, E), Y (B, N, E')
|
|
@@ -107,8 +107,9 @@ def loo(
|
|
|
107
107
|
d_min = np.fmax(distances.min(axis=2, keepdims=True), 1e-6) # (B, N, 1)
|
|
108
108
|
weights = np.exp(-distances / d_min) # (B, N, k)
|
|
109
109
|
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
# matmul avoids the (B, N, k, E') temporary that `weights[..., None] * Y_neighbors` would build
|
|
111
|
+
weighted_sum = np.matmul(weights[..., None, :], Y_neighbors).squeeze(-2) # (B, N, E')
|
|
112
|
+
predictions = weighted_sum / weights.sum(axis=2, keepdims=True) # (B, N, E')
|
|
112
113
|
|
|
113
114
|
return predictions
|
|
114
115
|
else:
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
from typing import TYPE_CHECKING
|
|
2
2
|
|
|
3
3
|
import numpy as np
|
|
4
|
-
from tinygrad import Tensor, dtypes
|
|
5
4
|
|
|
6
5
|
from edmkit.simplex_projection.knn import knn
|
|
7
6
|
from edmkit.util import pairwise_distance
|
|
@@ -113,8 +112,8 @@ def _numpy(
|
|
|
113
112
|
d_min = np.fmax(distances.min(axis=1, keepdims=True), 1e-6) # (M, 1)
|
|
114
113
|
weights = np.exp(-distances / d_min) # (M, k)
|
|
115
114
|
|
|
116
|
-
weighted_sum = np.
|
|
117
|
-
predictions = weighted_sum /
|
|
115
|
+
weighted_sum = np.matmul(weights[:, None, :], Y_neighbors).squeeze(-2) # (M, E')
|
|
116
|
+
predictions = weighted_sum / weights.sum(axis=1, keepdims=True)
|
|
118
117
|
|
|
119
118
|
return predictions.squeeze() # (M,) or (M, E')
|
|
120
119
|
# X (B, N, E), Y (B, N, E'), Q (B, M, E)
|
|
@@ -146,8 +145,8 @@ def _numpy(
|
|
|
146
145
|
d_min = np.fmax(distances.min(axis=2, keepdims=True), 1e-6) # (B, M, 1)
|
|
147
146
|
weights = np.exp(-distances / d_min) # (B, M, k)
|
|
148
147
|
|
|
149
|
-
weighted_sum = np.
|
|
150
|
-
predictions = weighted_sum /
|
|
148
|
+
weighted_sum = np.matmul(weights[..., None, :], Y_neighbors).squeeze(-2) # (B, M, E')
|
|
149
|
+
predictions = weighted_sum / weights.sum(axis=2, keepdims=True) # (B, M, E')
|
|
151
150
|
|
|
152
151
|
return predictions
|
|
153
152
|
else:
|
|
@@ -161,6 +160,10 @@ def _tensor(
|
|
|
161
160
|
*,
|
|
162
161
|
mask: np.ndarray | None = None,
|
|
163
162
|
):
|
|
163
|
+
# Lazy import: tinygrad starts a per-CPU async-executor pool at import time
|
|
164
|
+
# Loading it only when use_tensor=True keeps the numpy path free of that scheduler pressure.
|
|
165
|
+
from tinygrad import Tensor, dtypes
|
|
166
|
+
|
|
164
167
|
if X.ndim == 1:
|
|
165
168
|
X = X[:, None]
|
|
166
169
|
if Y.ndim == 1:
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import TYPE_CHECKING
|
|
4
|
+
|
|
1
5
|
import numpy as np
|
|
2
6
|
from scipy.spatial.distance import cdist
|
|
3
|
-
|
|
7
|
+
|
|
8
|
+
if TYPE_CHECKING:
|
|
9
|
+
from tinygrad import Tensor
|
|
4
10
|
|
|
5
11
|
|
|
6
12
|
def pad(As: list[np.ndarray]):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|