Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
a34c1fe
[ADD] Added new test files
SaVoAMP Feb 27, 2022
8500891
[ADD] Added pytests for 'mmotifs' and 'aamp_mmotifs'
SaVoAMP Feb 27, 2022
8362d74
[DEL] Deleted test templates for the multidimensional case
SaVoAMP Feb 27, 2022
03da632
[ADD] Added function to find one motif in all dimensions
SaVoAMP Feb 27, 2022
20c2783
[FIX] Reran black and flake8
SaVoAMP Feb 27, 2022
f66806b
[ADD] Added exclusion zone to function
SaVoAMP Feb 27, 2022
5cbe804
[MOD] Don't use naive implementation
SaVoAMP Feb 27, 2022
6495912
[ADD] Added arrange and assert to the first test function
SaVoAMP Feb 28, 2022
5e133d2
[MOD] Changed assertions to 'almost_equal'
SaVoAMP Feb 28, 2022
5518e68
[ADD] Added match functions from 'test_motifs.py'
SaVoAMP Feb 28, 2022
d086d6b
[ADD] Added dummy test
SaVoAMP Feb 28, 2022
a06f693
[DEL & ADD] Deleted test_match() and added test function with default…
SaVoAMP Mar 2, 2022
b4356a0
[ADD] Added test function to find the top two motifs
SaVoAMP Mar 2, 2022
26f91a3
Merge branch 'TDAmeritrade:main' into unit_test
SaVoAMP Mar 2, 2022
46ae307
[ADD] Added function to test 2-dimensional motif discovery
SaVoAMP Mar 2, 2022
d4612dd
[FIX] Fixed formatting
SaVoAMP Mar 2, 2022
d169441
[ADD] Added test function to find motifs with the 'max_motifs' parame…
SaVoAMP Mar 2, 2022
373dd5f
Revert "[ADD] Added test function to find motifs with the 'max_matche…
SaVoAMP Mar 2, 2022
bbf24d2
[ADD] Added test function to find motifs with the 'max_distance' para…
SaVoAMP Mar 2, 2022
5315fef
[ADD] Make copy of the matrix profile
SaVoAMP Mar 2, 2022
52e916c
[ADD] Also make copy of matrix profile in 'aamp_mmotifs.py'
SaVoAMP Mar 2, 2022
80bb136
Merge branch 'TDAmeritrade:main' into unit_test
SaVoAMP Mar 2, 2022
4551ed2
Merge branch 'TDAmeritrade:main' into unit_test
SaVoAMP Mar 2, 2022
3f314e9
Merge branch 'TDAmeritrade:main' into unit_test
SaVoAMP Mar 3, 2022
1405935
Merge branch 'TDAmeritrade:main' into unit_test
SaVoAMP Mar 4, 2022
eb49f1b
[FIX] Corrected the expected motif subspaces
Mar 4, 2022
5199cb1
[ADD] Added function to test the two dimensional and non-normalized m…
Mar 4, 2022
3313ebe
[MOD] Changed to naive matrix profile computation
Mar 7, 2022
5cb5a81
Merge branch 'TDAmeritrade:main' into unit_test
SaVoAMP Mar 9, 2022
65270e2
[ADD] Added 'query_idx' parameter to ensure that the self-match is re…
Mar 9, 2022
c13813b
Merge branch 'unit_test' of github.com:SaVoAMP/stumpy into unit_test
Mar 9, 2022
c8e5992
[MOD] Change subsequence length m and time series T
Mar 9, 2022
ccc50c7
[MOD] Change to naive computation and change time series
Mar 9, 2022
443bb1d
[MOD] Reformat file
Mar 9, 2022
d0c7859
[ADD] Add docstring documentation
Mar 9, 2022
870cf15
[MOD] Reformat file
Mar 9, 2022
498c8d9
[MOD] Modified docstring description for the 'query_idx' parameter
Mar 9, 2022
b9c2e66
[ADD] Added 'query_idx' to 'aamp_motifs'
Mar 9, 2022
d34d672
[ADD] Added 'query_idx' to function call of 'aamp_match'
Mar 9, 2022
f920c12
[ADD] Added 'query_idx' to '_motifs' and '_aamp_motifs'
Mar 10, 2022
4522153
[ADD] Added test function for 'max_matches=None'
Mar 12, 2022
cd65aea
[FIX] Set 'max_matches=None' instead of 'max_distance=None'
Mar 12, 2022
6e17bb0
[ADD] Add test function for cutoffs parameter
Mar 12, 2022
b3c3a9e
[ADD] Add test function for setting 'max_matches=None'
Mar 12, 2022
e33a57e
[ADD] Added comment to explain function in more detail
Mar 12, 2022
736120b
[ADD] Added test function for finding multiple motifs with the cutoff…
Mar 12, 2022
f7e3340
[ADD] Added 'pragma: no cover' comment
Mar 13, 2022
f126d7e
[DEL] Remove comment
Mar 14, 2022
519ec51
[MOD & DEL] Modified function ordering and removed comments
Mar 14, 2022
07e6f39
[MOD] Changed '_expected' to '_ref'
Mar 14, 2022
bd35644
[MOD] Marked comparison values with '_cmp'
Mar 14, 2022
8043e22
[MOD] Renamed functions
Mar 14, 2022
42a9c3a
[ADD] Added function that tests when cutoffs are a list
Mar 14, 2022
3cca021
[ADD] Also tested cutoffs as list in 'test_aamp_mmotifs'
Mar 14, 2022
73afb69
[MOD] Changed function ordering
Mar 14, 2022
ed8ea7f
[MOD] Declare time series array once at the beginning
Mar 14, 2022
97730b9
[MOD] Renamed functions
Mar 15, 2022
1f97aa1
[ADD] Added function with default parameters
Mar 15, 2022
7684825
[FIX] Fixed function names
Mar 15, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion stumpy/aamp_mmotifs.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ def aamp_mmotifs(
max_motifs = 1

T, T_subseq_isfinite = core.preprocess_non_normalized(T, m)
P = P.copy()

excl_zone = int(np.ceil(m / config.STUMPY_EXCL_ZONE_DENOM))

Expand Down Expand Up @@ -159,7 +160,7 @@ def aamp_mmotifs(
motif_value > cutoffs[k]
or not np.isfinite(motif_value)
or (isinstance(max_distance, float) and motif_value > max_distance)
):
): # pragma: no cover
break

query_matches = aamp_match(
Expand All @@ -169,6 +170,7 @@ def aamp_mmotifs(
max_matches=max_matches,
max_distance=max_distance,
atol=atol,
query_idx=motif_idx,
p=p,
)

Expand Down
16 changes: 15 additions & 1 deletion stumpy/aamp_motifs.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ def _aamp_motifs(
max_matches=None,
max_distance=max_distance,
atol=atol,
query_idx=candidate_idx,
p=p,
)

Expand Down Expand Up @@ -295,6 +296,7 @@ def aamp_match(
max_distance=None,
max_matches=None,
atol=1e-8,
query_idx=None,
p=2.0,
):
"""
Expand Down Expand Up @@ -334,6 +336,14 @@ def aamp_match(
The absolute tolerance parameter. This value will be added to `max_distance`
when comparing distances between subsequences.

query_idx : int, default None
This is the index position along the time series, `T`, where the query
subsequence, `Q`, is located.
`query_idx` should only be used when the matrix profile is a self-join and
should be set to `None` for matrix profiles computed from AB-joins.
If `query_idx` is set to a specific integer value, then this will help ensure
that the self-match will be returned first.

p : float, default 2.0
The p-norm to apply for computing the Minkowski distance.

Expand Down Expand Up @@ -381,7 +391,11 @@ def max_distance(D):

matches = []

candidate_idx = np.argmin(D)
if query_idx is not None:
candidate_idx = query_idx
else:
candidate_idx = np.argmin(D)

while (
D[candidate_idx] <= atol + max_distance
and np.isfinite(D[candidate_idx])
Expand Down
4 changes: 3 additions & 1 deletion stumpy/mmotifs.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ def mmotifs(
max_motifs = 1

T, M_T, Σ_T = core.preprocess(T, m)
P = P.copy()

excl_zone = int(np.ceil(m / config.STUMPY_EXCL_ZONE_DENOM))

Expand Down Expand Up @@ -178,7 +179,7 @@ def mmotifs(
motif_value > cutoffs[k]
or not np.isfinite(motif_value)
or (isinstance(max_distance, float) and motif_value > max_distance)
):
): # pragma: no cover
break

query_matches = match(
Expand All @@ -189,6 +190,7 @@ def mmotifs(
max_matches=max_matches,
max_distance=max_distance,
atol=atol,
query_idx=motif_idx,
normalize=normalize,
p=p,
)
Expand Down
16 changes: 15 additions & 1 deletion stumpy/motifs.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ def _motifs(
max_matches=None,
max_distance=max_distance,
atol=atol,
query_idx=candidate_idx,
)

if len(query_matches) > min_neighbors:
Expand Down Expand Up @@ -322,6 +323,7 @@ def match(
max_distance=None,
max_matches=None,
atol=1e-8,
query_idx=None,
normalize=True,
p=2.0,
):
Expand Down Expand Up @@ -365,6 +367,14 @@ def match(
The absolute tolerance parameter. This value will be added to `max_distance`
when comparing distances between subsequences.

query_idx : int, default None
This is the index position along the time series, `T`, where the query
subsequence, `Q`, is located.
`query_idx` should only be used when the matrix profile is a self-join and
should be set to `None` for matrix profiles computed from AB-joins.
If `query_idx` is set to a specific integer value, then this will help ensure
that the self-match will be returned first.

normalize : bool, default True
When set to `True`, this z-normalizes subsequences prior to computing distances.
Otherwise, this function gets re-routed to its complementary non-normalized
Expand Down Expand Up @@ -433,7 +443,11 @@ def max_distance(D):

matches = []

candidate_idx = np.argmin(D)
if query_idx is not None:
candidate_idx = query_idx
else:
candidate_idx = np.argmin(D)

while (
D[candidate_idx] <= atol + max_distance
and np.isfinite(D[candidate_idx])
Expand Down
4 changes: 4 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ test_unit()
check_errs $?
pytest -x -W ignore::RuntimeWarning -W ignore::DeprecationWarning tests/test_motifs.py
check_errs $?
pytest -x -W ignore::RuntimeWarning -W ignore::DeprecationWarning tests/test_mmotifs.py
check_errs $?
pytest -x -W ignore::RuntimeWarning -W ignore::DeprecationWarning tests/test_gpu_mpdist.py
pytest -x -W ignore::RuntimeWarning -W ignore::DeprecationWarning tests/test_snippets.py
check_errs $?
Expand All @@ -132,6 +134,8 @@ test_unit()
check_errs $?
pytest -x -W ignore::RuntimeWarning -W ignore::DeprecationWarning tests/test_aamp_motifs.py
check_errs $?
pytest -x -W ignore::RuntimeWarning -W ignore::DeprecationWarning tests/test_aamp_mmotifs.py
check_errs $?
pytest -x -W ignore::RuntimeWarning -W ignore::DeprecationWarning tests/test_gpu_aampdist.py
pytest -x -W ignore::RuntimeWarning -W ignore::DeprecationWarning tests/test_aampdist_snippets.py
check_errs $?
Expand Down
Loading