Skip to content

Commit 0cf2cd6

Browse files
committed
Fixed #103 Finished MSTUMP Tutorial
1 parent d18d8c9 commit 0cf2cd6

File tree

6 files changed

+286
-92
lines changed

6 files changed

+286
-92
lines changed

docs/Tutorial_Multidimensional_Motif_Discovery.ipynb

Lines changed: 273 additions & 81 deletions
Large diffs are not rendered by default.

docs/Tutorial_STUMPY_Basics.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,7 @@
829829
"\n",
830830
"## STUMPED - Distributed STUMP\n",
831831
"\n",
832-
"Alternatively, if you only have access to a cluster of CPUs and your data needs to stay behind your firewall, then `stump` and `gpu_stump` may not be sufficient for your needs. Instead, you can try `stumped`, a distributed and parallel implementation of `stump` that depends on Dask distributed:\n",
832+
"Alternatively, if you only have access to a cluster of CPUs and your data needs to stay behind your firewall, then `stump` and `gpu_stump` may not be sufficient for your needs. Instead, you can try `stumped`, a distributed and parallel implementation of `stump` that depends on [Dask distributed](https://distributed.dask.org/en/latest/):\n",
833833
"\n",
834834
"```\n",
835835
"import stumpy\n",

docs/api.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ STUMPY API
1414
stumpy.stumpi
1515
stumpy.mstump
1616
stumpy.mstumped
17+
stumpy.subspace
1718
stumpy.aamp
1819
stumpy.aamped
1920
stumpy.gpu_aamp
@@ -70,6 +71,10 @@ mstumped
7071

7172
.. autofunction:: stumpy.mstumped
7273

74+
subspace
75+
========
76+
.. autofunction:: stumpy.subspace
77+
7378
aamp
7479
====
7580

stumpy/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import os.path
33
from .stump import stump # noqa: F401
44
from .stumped import stumped # noqa: F401
5-
from .mstump import mstump # noqa: F401
5+
from .mstump import mstump, subspace # noqa: F401
66
from .mstumped import mstumped # noqa: F401
77
from .aamp import aamp # noqa: F401
88
from .aamped import aamped # noqa: F401

stumpy/mstump.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def _discretize(a, bins, right=True):
192192
return np.digitize(a, bins, right=right)
193193

194194

195-
def _get_subspace(T, m, subseq_idx, nn_idx, k, include=None, discords=False):
195+
def subspace(T, m, subseq_idx, nn_idx, k, include=None, discords=False):
196196
"""
197197
Compute the multi-dimensional matrix profile subspace for a given subseq index and
198198
its nearest neighbor index

tests/test_mstump.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@
22
import numpy.testing as npt
33
import pandas as pd
44
from stumpy import core, config
5-
from stumpy import mstump
5+
from stumpy import mstump, subspace
66
from stumpy.mstump import (
77
_mstump,
88
_multi_mass,
99
_query_mstump_profile,
1010
_get_first_mstump_profile,
1111
_get_multi_QT,
1212
_apply_include,
13-
_get_subspace,
1413
)
1514
import pytest
1615
import naive
@@ -141,7 +140,7 @@ def test_subspace(T, m):
141140

142141
for k in range(T.shape[0]):
143142
ref_S = naive.subspace(T, m, motif_idx, nn_idx, k)
144-
comp_S = _get_subspace(T, m, motif_idx, nn_idx, k)
143+
comp_S = subspace(T, m, motif_idx, nn_idx, k)
145144
npt.assert_almost_equal(ref_S, comp_S)
146145

147146

@@ -155,7 +154,7 @@ def test_subspace_include(T, m):
155154

156155
for k in range(T.shape[0]):
157156
ref_S = naive.subspace(T, m, motif_idx, nn_idx, k, include)
158-
comp_S = _get_subspace(T, m, motif_idx, nn_idx, k, include)
157+
comp_S = subspace(T, m, motif_idx, nn_idx, k, include)
159158
npt.assert_almost_equal(ref_S, comp_S)
160159

161160

@@ -166,7 +165,7 @@ def test_subspace_discords(T, m):
166165

167166
for k in range(T.shape[0]):
168167
ref_S = naive.subspace(T, m, discord_idx, nn_idx, k, discords=True)
169-
comp_S = _get_subspace(T, m, discord_idx, nn_idx, k, discords=True)
168+
comp_S = subspace(T, m, discord_idx, nn_idx, k, discords=True)
170169
npt.assert_almost_equal(ref_S, comp_S)
171170

172171

@@ -182,9 +181,7 @@ def test_subspace_include_discords(T, m):
182181
ref_S = naive.subspace(
183182
T, m, discord_idx, nn_idx, k, include, discords=True
184183
)
185-
comp_S = _get_subspace(
186-
T, m, discord_idx, nn_idx, k, include, discords=True
187-
)
184+
comp_S = subspace(T, m, discord_idx, nn_idx, k, include, discords=True)
188185
npt.assert_almost_equal(ref_S, comp_S)
189186

190187

0 commit comments

Comments
 (0)