Skip to content

Commit 7ba54d5

Browse files
committed
[DOC] Fix inconsistent double backticks in similarity_search module (aeon-toolkit#809)
1 parent f2c2aad commit 7ba54d5

File tree

6 files changed

+573
-580
lines changed

6 files changed

+573
-580
lines changed

aeon/similarity_search/base.py

+18-18
Original file line numberDiff line numberDiff line change
@@ -21,35 +21,35 @@ class BaseSimilaritySearch(BaseCollectionEstimator):
2121
Parameters
2222
----------
2323
distance : str, default="euclidean"
24-
Name of the distance function to use. A list of valid strings can be found in
25-
the documentation for :func:`aeon.distances.get_distance_function`.
26-
If a callable is passed it must either be a python function or numba function
27-
with nopython=True, that takes two 1d numpy arrays as input and returns a float.
24+
The name of the distance function to use. A list of valid strings can be found in
25+
the documentation for ``aeon.distances.get_distance_function``.
26+
If a callable is passed, it must be either a Python function or a Numba function
27+
with ``nopython=True`` that takes two 1D numpy arrays as input and returns a float.
2828
distance_args : dict, default=None
2929
Optional keyword arguments for the distance function.
3030
inverse_distance : bool, default=False
31-
If True, the matching will be made on the inverse of the distance, and thus, the
32-
worst matches to the query will be returned instead of the best ones.
31+
If ``True``, the matching will be based on the inverse of the distance,
32+
returning the worst matches instead of the best ones.
3333
normalise : bool, default=False
34-
Whether the distance function should be z-normalised.
35-
speed_up : str, default='fastest'
36-
Which speed up technique to use with for the selected distance
37-
function. By default, the fastest algorithm is used. A list of available
38-
algorithm for each distance can be obtained by calling the
39-
`get_speedup_function_names` function of the child classes.
34+
Whether the distance function should be z-normalized.
35+
speed_up : str, default="fastest"
36+
Which speed-up technique to use for the selected distance function.
37+
By default, the fastest algorithm is used. A list of available algorithms
38+
for each distance can be obtained by calling the
39+
``get_speedup_function_names`` method of the child classes.
4040
n_jobs : int, default=1
41-
Number of parallel jobs to use.
41+
The number of parallel jobs to use.
4242
4343
Attributes
4444
----------
45-
X_ : np.ndarray, 3D array of shape (n_cases, n_channels, n_timepoints)
46-
The input time series stored during the fit method.
45+
X_ : np.ndarray
46+
A 3D array of shape ``(n_cases, n_channels, n_timepoints)`` storing the
47+
input time series during the fit method.
4748
4849
Notes
4950
-----
50-
For now, the multivariate case is only treated as independent.
51-
Distances are computed for each channel independently and then
52-
summed together.
51+
Currently, the multivariate case is treated independently.
52+
Distances are computed for each channel separately and then summed together.
5353
"""
5454

5555
_tags = {

aeon/similarity_search/distance_profiles/euclidean_distance_profile.py

+45-44
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,30 @@ def euclidean_distance_profile(
1818
X: Union[np.ndarray, List], q: np.ndarray, mask: np.ndarray
1919
) -> np.ndarray:
2020
"""
21-
Compute a distance profile using the squared Euclidean distance.
22-
23-
It computes the distance profiles between the input time series and the query using
24-
the squared Euclidean distance. The distance between the query and a candidate is
25-
comptued using a dot product and a rolling sum to avoid recomputing parts of the
26-
operation.
27-
28-
Parameters
29-
----------
30-
X: np.ndarray, 3D array of shape (n_cases, n_channels, n_timepoints)
31-
The input samples. If X is an unquel length collection, expect a numba TypedList
32-
of 2D arrays of shape (n_channels, n_timepoints)
33-
q : np.ndarray, 2D array of shape (n_channels, query_length)
34-
The query used for similarity search.
35-
mask : np.ndarray, 3D array of shape (n_cases, n_channels, n_timepoints - query_length + 1) # noqa: E501
36-
Boolean mask of the shape of the distance profile indicating for which part
37-
of it the distance should be computed.
38-
39-
Returns
40-
-------
41-
distance_profiles : np.ndarray
42-
3D array of shape (n_cases, n_timepoints - query_length + 1)
43-
The distance profile between q and the input time series X.
21+
Compute the distance profile using the squared Euclidean distance.
22+
23+
This method calculates the distance profiles between the input time series and the query
24+
using the squared Euclidean distance. To optimize computation, it utilizes a dot product
25+
and a rolling sum, reducing redundant calculations.
26+
27+
Parameters
28+
----------
29+
X : np.ndarray or numba.typed.List
30+
- If X is a NumPy array, it should have the shape ``(n_cases, n_channels, n_timepoints)``.
31+
- If X contains sequences of unequal lengths, it should be a numba ``TypedList``
32+
of 2D arrays, each with the shape ``(n_channels, n_timepoints)``.
33+
q : np.ndarray
34+
- A 2D array of shape ``(n_channels, query_length)`` representing the query used
35+
for similarity search.
36+
mask : np.ndarray
37+
- A 3D boolean array of shape ``(n_cases, n_channels, n_timepoints - query_length + 1)``
38+
that specifies which parts of the distance profile should be computed.
39+
40+
Returns
41+
-------
42+
distance_profiles : np.ndarray
43+
- A 3D array of shape ``(n_cases, n_timepoints - query_length + 1)`` representing
44+
the distance profiles between the query ``q`` and the input time series ``X``.
4445
4546
"""
4647
distance_profiles = squared_distance_profile(X, q, mask)
@@ -60,37 +61,37 @@ def normalised_euclidean_distance_profile(
6061
q_stds: np.ndarray,
6162
) -> np.ndarray:
6263
"""
63-
Compute a distance profile in a brute force way.
64+
Compute a distance profile using brute force.
6465
6566
It computes the distance profiles between the input time series and the query using
66-
the specified distance. The search is made in a brute force way without any
67+
the specified distance. The search is performed in a brute-force manner without any
6768
optimizations and can thus be slow.
6869
6970
Parameters
7071
----------
71-
X: np.ndarray, 3D array of shape (n_cases, n_channels, n_timepoints)
72-
The input samples. If X is an unquel length collection, expect a numba TypedList
73-
of 2D arrays of shape (n_channels, n_timepoints)
74-
q : np.ndarray, 2D array of shape (n_channels, query_length)
72+
X : np.ndarray, 3D array of shape ``(n_cases, n_channels, n_timepoints)``
73+
The input samples. If `X` is an **unequal** length collection, expect a numba
74+
``TypedList`` of 2D arrays of shape ``(n_channels, n_timepoints)``.
75+
q : np.ndarray, 2D array of shape ``(n_channels, query_length)``
7576
The query used for similarity search.
76-
mask : np.ndarray, 3D array of shape (n_cases, n_channels, n_timepoints - query_length + 1) # noqa: E501
77-
Boolean mask of the shape of the distance profile indicating for which part
78-
of it the distance should be computed.
79-
X_means : np.ndarray, 3D array of shape (n_cases, n_channels, n_timepoints - query_length + 1) # noqa: E501
80-
Means of each subsequences of X of size query_length. Should be a numba
81-
TypedList if X is unequal length.
82-
X_stds : np.ndarray, 3D array of shape (n_cases, n_channels, n_timepoints - query_length + 1) # noqa: E501
83-
Stds of each subsequences of X of size query_length. Should be a numba
84-
TypedList if X is unequal length.
85-
q_means : np.ndarray, 1D array of shape (n_channels)
86-
Means of the query q
87-
q_stds : np.ndarray, 1D array of shape (n_channels)
77+
mask : np.ndarray, 3D array of shape ``(n_cases, n_channels, n_timepoints - query_length + 1)``
78+
Boolean mask indicating for which part of the distance profile the computation
79+
should be performed.
80+
X_means : np.ndarray, 3D array of shape ``(n_cases, n_channels, n_timepoints - query_length + 1)``
81+
Means of each subsequence of ``X`` of size ``query_length``. Should be a numba
82+
``TypedList`` if ``X`` is of unequal length.
83+
X_stds : np.ndarray, 3D array of shape ``(n_cases, n_channels, n_timepoints - query_length + 1)``
84+
Standard deviations of each subsequence of ``X`` of size ``query_length``. Should be
85+
a numba ``TypedList`` if ``X`` is of unequal length.
86+
q_means : np.ndarray, 1D array of shape ``(n_channels,)``
87+
Means of the query ``q``.
88+
q_stds : np.ndarray, 1D array of shape ``(n_channels,)``
89+
Standard deviations of the query ``q``.
8890
8991
Returns
9092
-------
91-
distance_profiles : np.ndarray
92-
3D array of shape (n_cases, n_timepoints - query_length + 1)
93-
The distance profile between q and the input time series X.
93+
distance_profiles : np.ndarray, 3D array of shape ``(n_cases, n_timepoints - query_length + 1)``
94+
The computed distance profile between ``q`` and the input time series ``X``.
9495
9596
"""
9697
distance_profiles = normalised_squared_distance_profile(

0 commit comments

Comments
 (0)