imste 0.2.1__py3-none-any.whl
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.
- imste/__init__.py +15 -0
- imste/_api.py +28 -0
- imste/_estimator.py +1106 -0
- imste/_estimator_graph.py +241 -0
- imste/_estimator_utils.py +249 -0
- imste/_gravity.py +295 -0
- imste/_mean_shift.py +87 -0
- imste/_multilevel.py +259 -0
- imste/_optimizer.py +355 -0
- imste/_optimizer_mps.py +8 -0
- imste/_optimizer_torch.py +296 -0
- imste/_progress.py +261 -0
- imste/_visualization_class_geometry.py +612 -0
- imste/_visualization_core.py +607 -0
- imste/_visualization_interactive.py +453 -0
- imste/class_graph.py +444 -0
- imste/inductive.py +394 -0
- imste/losses.py +45 -0
- imste/mst/__init__.py +62 -0
- imste/mst/famst.py +963 -0
- imste/mst/graph.py +141 -0
- imste/mst/prim.py +283 -0
- imste/visualization.py +31 -0
- imste-0.2.1.dist-info/METADATA +544 -0
- imste-0.2.1.dist-info/RECORD +28 -0
- imste-0.2.1.dist-info/WHEEL +5 -0
- imste-0.2.1.dist-info/licenses/LICENSE +21 -0
- imste-0.2.1.dist-info/top_level.txt +1 -0
imste/__init__.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""IMSTE (Iterated Minimum Spanning Tree Embedding)."""
|
|
2
|
+
|
|
3
|
+
from ._estimator import IteratedMinimumSpanningTreeEmbedder
|
|
4
|
+
from ._api import fit_graph_transform
|
|
5
|
+
from .losses import (
|
|
6
|
+
log_attraction_loss,
|
|
7
|
+
logistic_repulsion_loss,
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
__all__ = [
|
|
11
|
+
"IteratedMinimumSpanningTreeEmbedder",
|
|
12
|
+
"fit_graph_transform",
|
|
13
|
+
"log_attraction_loss",
|
|
14
|
+
"logistic_repulsion_loss",
|
|
15
|
+
]
|
imste/_api.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""Convenience functions for direct IMSTE fits."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
import numpy as np
|
|
8
|
+
from scipy.sparse import spmatrix
|
|
9
|
+
|
|
10
|
+
from ._estimator import IteratedMinimumSpanningTreeEmbedder
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def fit_graph_transform(
|
|
14
|
+
distance_graph: spmatrix,
|
|
15
|
+
*,
|
|
16
|
+
init_features: object | None = None,
|
|
17
|
+
**estimator_params: Any,
|
|
18
|
+
) -> np.ndarray:
|
|
19
|
+
"""Fit IMSTE from a sparse distance graph and return its embedding.
|
|
20
|
+
|
|
21
|
+
``init_features`` optionally supplies one feature row per graph node for
|
|
22
|
+
PCA initialization. Remaining keyword arguments configure the estimator.
|
|
23
|
+
"""
|
|
24
|
+
estimator = IteratedMinimumSpanningTreeEmbedder(**estimator_params)
|
|
25
|
+
return estimator.fit_graph_transform(
|
|
26
|
+
distance_graph,
|
|
27
|
+
init_features=init_features,
|
|
28
|
+
)
|