Skip to content

Commit 54cd2fa

Browse files
committed
improve comments
1 parent 9349e2a commit 54cd2fa

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

stumpy/core.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ def check_window_size(m, max_size=None, n=None):
559559
Check the window size and ensure that it is greater than or equal to 3 and, if
560560
`max_size` is provided, ensure that the window size is less than or equal to the
561561
`max_size`. Furthermore, if `n` is provided, then it checks if there is
562-
at least one subsequence with no non-trivial neighbour in a self-join.
562+
at least one subsequence with no non-trivial neighbor in a self-join.
563563
564564
Parameters
565565
----------
@@ -600,37 +600,37 @@ def check_window_size(m, max_size=None, n=None):
600600

601601
# For any time series `T`, an "eligible nearest neighbor" subsequence for
602602
# the central-most subsequence must be located outside the `excl_zone`,
603-
# and the central-most subsequence will ALWAYS have the smallest relative
604-
# (index-wise) distance to its farthest neighbor amongst all other subsequences.
605-
# Therefore, we only need to check whether the `excl_zone` eliminates all "neighbors"
606-
# for the central-most subsequence in `T`. In fact, we just need to verify whether
607-
# the `excl_zone` eliminates the "neighbor" that is farthest away (index-wise)
608-
# from the central-most subsequence. If it does not, this implies that all
609-
# subsequences in `T` will have at least one "eligible nearest neighbors"
610-
# outside their respective `excl_zone`
603+
# and the central-most subsequence will ALWAYS have the smallest relative
604+
# (index-wise) distance to its farthest neighbor amongst all other subsequences.
605+
# Therefore, we only need to check whether the `excl_zone` eliminates all
606+
# "neighbors" for the central-most subsequence in `T`. In fact, we just need to
607+
# verify whether the `excl_zone` eliminates the "neighbor" that is farthest
608+
# away (index-wise) from the central-most subsequence. If it does not, this
609+
# implies that all subsequences in `T` will have at least one "eligible nearest
610+
# neighbors" outside their respective `excl_zone`
611611

612612
excl_zone = int(math.ceil(m / config.STUMPY_EXCL_ZONE_DENOM))
613613

614-
l = n - m + 1
614+
l = n - m + 1
615615
# The start index of subsequences are: 0, 1, ..., l-1
616616

617617
# If `l` is odd (hence, `l == 2c+1`):
618-
# The central subsequence is located at index `c == l // 2`,
618+
# The central subsequence is located at index `c == l // 2`,
619619
# with two farthest neighbors, one located at index `0`(to the left of `c`)
620-
# and the other located at index `l - 1 == 2c` (to the right of `c`).
620+
# and the other located at index `l - 1 == 2c` (to the right of `c`).
621621
# Both indices `0` and `2c` are exactly `c == l // 2` index positions away
622622
# from the central subsequence located at index `c`.
623623

624624
# If `l` is even (hence, `l == 2c`):
625-
# There are two central-most subsequences located at index locations
625+
# There are two central-most subsequences located at index locations
626626
# `c` and `c-1`. For subsequence at `c`, its farthest neighbor will be
627627
# located at index `0` (to the left of `c`) and, for `c-1`, its farthest
628628
# neighbor is located at index `l - 1 == 2c - 1` (to the right of `c-1`).
629-
# In both cases, each central subsequence and its farthest neighbor are
629+
# In both cases, each central subsequence and its farthest neighbor are
630630
# `c == l // 2` indices away.
631631

632632
# Therefore, regardless if `l` is even or odd, for the central
633-
# subsequence for any time series, the index location of its
633+
# subsequence for any time series, the index location of its
634634
# farthest neighbor will always be `l // 2` index positions away.
635635
diff_to_farthest_idx = l // 2
636636
if diff_to_farthest_idx <= excl_zone:

0 commit comments

Comments
 (0)