Skip to content

Commit fa63e6e

Browse files
AnaghDeshpandepatrickzibMatthewMiddlehurst
authored
[DOC] resolved the inconsistency of double ticks for the anomaly detection module #809 (#2546)
* resolved the inconsistency of double quotes * resolved the inconsistency of double ticks * resolved the pre-commit errors occuring due to flake8 * Update _cblof.py made changes in line number 19 and 145. * Automatic `pre-commit` fixes * Update _copod.py made changes in line number 76 * Automatic `pre-commit` fixes * Update _iforest.py made changes in line number 19 * Automatic `pre-commit` fixes * Update _kmeans.py made changes in line number 178 * Automatic `pre-commit` fixes * Update _merlin.py made changes in line number 215 * Automatic `pre-commit` fixes * Update _one_class_svm.py made changes in line number 19 * Automatic `pre-commit` fixes * Update _pyodadapter.py made changes in line number 165 * Update _stomp.py made changes in line number 125 * Automatic `pre-commit` fixes * converted directives to single ticks * added double ticks to code ref * fixed link in cblof.py and some other minor changes * Update base.py --------- Co-authored-by: Patrick Schäfer <patrick.schaefer@hu-berlin.de> Co-authored-by: Matthew Middlehurst <pfm15hbu@gmail.com>
1 parent 08191f2 commit fa63e6e

File tree

10 files changed

+72
-64
lines changed

10 files changed

+72
-64
lines changed

aeon/anomaly_detection/series/_pyodadapter.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ class PyODAdapter(BaseSeriesAnomalyDetector):
4040
target time series with the same number of dimensions. The reference (or training)
4141
time series does not need to be clean for most PyOD models. However, knowledge in
4242
form of anomaly labels about the potential existing anomalies in the reference time
43-
series are not used during the fitting process. Use `fit` to fit the model on the
44-
reference time series and `predict` to detect anomalies in the target time series.
45-
For unsupervised anomaly detection, use `fit_predict` directly on the target time
43+
series are not used during the fitting process. Use ``fit`` to fit the model on the
44+
reference time series and ``predict`` to detect anomalies in the target time series.
45+
For unsupervised anomaly detection, use ``fit_predict`` directly on the target time
4646
series.
4747
4848
@@ -160,14 +160,15 @@ def _get_test_params(cls, parameter_set="default"):
160160
----------
161161
parameter_set : str, default="default"
162162
Name of the set of test parameters to return, for use in tests. If no
163-
special parameters are defined for a value, will return `"default"` set.
163+
special parameters are defined for a value, will return ``"default"`` set.
164164
165165
Returns
166166
-------
167167
params : dict or list of dict, default={}
168168
Parameters to create testing instances of the class.
169169
Each dict are parameters to construct an "interesting" test instance, i.e.,
170-
`MyClass(**params)` or `MyClass(**params[i])` creates a valid test instance.
170+
``MyClass(**params)`` or ``MyClass(**params[i])`` creates a valid
171+
test instance.
171172
"""
172173
_check_soft_dependencies(*cls._tags["python_dependencies"])
173174

aeon/anomaly_detection/series/distance_based/_cblof.py

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,16 @@ class CBLOF(PyODAdapter):
1616
1717
This class implements the CBLOF algorithm for anomaly detection
1818
using PyODAdadpter to be used in the aeon framework. All parameters are passed to
19-
the PyOD model ``CBLOF`` except for `window_size` and `stride`, which are used to
20-
construct the sliding windows.
19+
the PyOD model ``CBLOF`` except for ``window_size`` and ``stride``,
20+
which are used to construct the sliding windows.
2121
2222
The documentation for parameters has been adapted from the
23-
[PyOD documentation](https://pyod.readthedocs.io/en/latest/pyod.models.html#id117).
24-
Here, `X` refers to the set of sliding windows extracted from the time series
23+
`PyOD documentation <https://pyod.readthedocs.io/en/latest/pyod.models.html#id117>`_
24+
25+
Here, ``X`` refers to the set of sliding windows extracted from the time series
2526
using :func:`aeon.utils.windowing.sliding_windows` with the parameters
26-
``window_size`` and ``stride``. The internal `X` has the shape
27-
`(n_windows, window_size * n_channels)`.
27+
``window_size`` and ``stride``. The internal ``X`` has the shape
28+
``(n_windows, window_size * n_channels)``.
2829
2930
Parameters
3031
----------
@@ -52,21 +53,21 @@ class CBLOF(PyODAdapter):
5253
5354
beta : int or float in (1,), default=5
5455
Coefficient for deciding small and large clusters. For a list
55-
sorted clusters by size `|C1|, \|C2|, ..., |Cn|, beta = |Ck|/|Ck-1|`
56+
sorted clusters by size ``|C1|, |C2|, ..., |Cn|, beta = |Ck|/|Ck-1|``
5657
5758
use_weights : bool, default=False
58-
If set to True, the size of clusters are used as weights in
59+
If set to ``True``, the size of clusters are used as weights in
5960
outlier score calculation.
6061
6162
check_estimator : bool, default=False
62-
If set to True, check whether the base estimator is consistent with
63+
If set to ``True``, check whether the base estimator is consistent with
6364
sklearn standard.
6465
6566
random_state : int, np.RandomState or None, default=None
66-
If int, random_state is the seed used by the random
67+
If ``int``, random_state is the seed used by the random
6768
number generator; If RandomState instance, random_state is the random
68-
number generator; If None, the random number generator is the
69-
RandomState instance used by `np.random`.
69+
number generator; If ``None``, the random number generator is the
70+
RandomState instance used by ``np.random``.
7071
7172
window_size : int, default=10
7273
Size of the sliding window.
@@ -138,15 +139,16 @@ def _get_test_params(cls, parameter_set="default"):
138139
----------
139140
parameter_set : str, default="default"
140141
Name of the set of test parameters to return, for use in tests. If no
141-
special parameters are defined for a value, will return `"default"` set.
142+
special parameters are defined for a value, will return ``"default"`` set.
142143
143144
Returns
144145
-------
145146
params : dict
146147
Parameters to create testing instances of the class.
147148
Each dict are parameters to construct an "interesting" test instance, i.e.,
148-
`MyClass(**params)` or `MyClass(**params[i])` creates a valid test instance.
149-
`create_test_instance` uses the first (or only) dictionary in `params`.
149+
``MyClass(**params)`` or ``MyClass(**params[i])`` creates a valid test
150+
instance. ``create_test_instance`` uses the first (or only) dictionary
151+
in ``params``.
150152
"""
151153
return {
152154
"n_clusters": 4,

aeon/anomaly_detection/series/distance_based/_kmeans.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,14 +171,15 @@ def _get_test_params(cls, parameter_set="default"):
171171
----------
172172
parameter_set : str, default="default"
173173
Name of the set of test parameters to return, for use in tests. If no
174-
special parameters are defined for a value, will return `"default"` set.
174+
special parameters are defined for a value, will return ``"default"`` set.
175175
176176
Returns
177177
-------
178178
dict or list of dict, default={}
179179
Parameters to create testing instances of the class.
180180
Each dict are parameters to construct an "interesting" test instance, i.e.,
181-
`MyClass(**params)` or `MyClass(**params[i])` creates a valid test instance.
181+
``MyClass(**params)`` or ``MyClass(**params[i])`` creates a valid
182+
test instance.
182183
"""
183184
return {
184185
"n_clusters": 5,

aeon/anomaly_detection/series/distance_based/_lof.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ class LOF(PyODAdapter):
1919
2020
The documentation for parameters has been adapted from the
2121
[PyOD documentation](https://pyod.readthedocs.io/en/latest/pyod.models.html#id586).
22-
Here, `X` refers to the set of sliding windows extracted from the time series
22+
Here, ``X`` refers to the set of sliding windows extracted from the time series
2323
using :func:`aeon.utils.windowing.sliding_windows` with the parameters
24-
``window_size`` and ``stride``. The internal `X` has the shape
25-
`(n_windows, window_size * n_channels)`.
24+
``window_size`` and ``stride``. The internal ``X`` has the shape
25+
``(n_windows, window_size * n_channels)``.
2626
2727
Parameters
2828
----------
2929
n_neighbors : int, optional (default=20)
30-
Number of neighbors to use by default for `kneighbors` queries.
30+
Number of neighbors to use by default for ``kneighbors`` queries.
3131
If n_neighbors is larger than the number of samples provided,
3232
all samples will be used.
3333
algorithm : {'auto', 'ball_tree', 'kd_tree', 'brute'}, optional
@@ -36,11 +36,11 @@ class LOF(PyODAdapter):
3636
- 'kd_tree' will use KDTree
3737
- 'brute' will use a brute-force search.
3838
- 'auto' will attempt to decide the most appropriate algorithm
39-
based on the values passed to :meth:`fit` method.
39+
based on the values passed to :meth:``fit`` method.
4040
Note: fitting on sparse input will override the setting of
4141
this parameter, using brute force.
4242
leaf_size : int, optional (default=30)
43-
Leaf size passed to `BallTree` or `KDTree`. This can
43+
Leaf size passed to ``BallTree`` or ``KDTree``. This can
4444
affect the speed of the construction and query, as well as the memory
4545
required to store the tree. The optimal value depends on the
4646
nature of the problem.

aeon/anomaly_detection/series/distance_based/_merlin.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,13 +210,14 @@ def _get_test_params(cls, parameter_set="default"):
210210
----------
211211
parameter_set : str, default="default"
212212
Name of the set of test parameters to return, for use in tests. If no
213-
special parameters are defined for a value, will return `"default"` set.
213+
special parameters are defined for a value, will return ``"default"`` set.
214214
215215
Returns
216216
-------
217217
params : dict or list of dict, default={}
218218
Parameters to create testing instances of the class.
219219
Each dict are parameters to construct an "interesting" test instance, i.e.,
220-
`MyClass(**params)` or `MyClass(**params[i])` creates a valid test instance.
220+
``MyClass(**params)`` or ``MyClass(**params[i])`` creates a valid
221+
test instance.
221222
"""
222223
return {"min_length": 4, "max_length": 7}

aeon/anomaly_detection/series/distance_based/_stomp.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,15 @@ def _get_test_params(cls, parameter_set="default"):
117117
----------
118118
parameter_set : str, default="default"
119119
Name of the set of test parameters to return, for use in tests. If no
120-
special parameters are defined for a value, will return `"default"` set.
120+
special parameters are defined for a value, will return ``"default"`` set.
121121
122122
Returns
123123
-------
124124
params : dict or list of dict, default={}
125125
Parameters to create testing instances of the class.
126126
Each dict are parameters to construct an "interesting" test instance, i.e.,
127-
`MyClass(**params)` or `MyClass(**params[i])` creates a valid test instance.
127+
``MyClass(**params)`` or ``MyClass(**params[i])`` creates a valid
128+
test instance.
128129
"""
129130
return {
130131
"window_size": 10,

aeon/anomaly_detection/series/distribution_based/_copod.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ class COPOD(PyODAdapter):
1515
"""COPOD for anomaly detection.
1616
1717
This class implements the COPOD using PyODAdadpter to be used in the aeon framework.
18-
The parameter `n_jobs` is passed to COPOD model from PyOD, `window_size` and
19-
`stride` are used to construct the sliding windows.
18+
The parameter ``n_jobs`` is passed to COPOD model from PyOD, ``window_size`` and
19+
``stride`` are used to construct the sliding windows.
2020
2121
Parameters
2222
----------
@@ -69,14 +69,15 @@ def _get_test_params(cls, parameter_set="default") -> dict:
6969
----------
7070
parameter_set : str, default="default"
7171
Name of the set of test parameters to return, for use in tests. If no
72-
special parameters are defined for a value, will return `"default"` set.
72+
special parameters are defined for a value, will return ``"default"`` set.
7373
7474
Returns
7575
-------
7676
params : dict or list of dict, default={}
7777
Parameters to create testing instances of the class.
7878
Each dict are parameters to construct an "interesting" test instance, i.e.,
79-
`MyClass(**params)` or `MyClass(**params[i])` creates a valid test instance.
80-
`create_test_instance` uses the first (or only) dictionary in `params`.
79+
``MyClass(**params)`` or ``MyClass(**params[i])`` creates a valid test
80+
instance. ``create_test_instance`` uses the first (or only) dictionary
81+
in ``params``.
8182
"""
8283
return {}

aeon/anomaly_detection/series/distribution_based/_dwt_mlead.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,14 +237,15 @@ def _get_test_params(cls, parameter_set="default"):
237237
----------
238238
parameter_set : str, default="default"
239239
Name of the set of test parameters to return, for use in tests. If no
240-
special parameters are defined for a value, will return `"default"` set.
240+
special parameters are defined for a value, will return ``"default"`` set.
241241
242242
Returns
243243
-------
244244
params : dict or list of dict, default={}
245245
Parameters to create testing instances of the class.
246246
Each dict are parameters to construct an "interesting" test instance, i.e.,
247-
`MyClass(**params)` or `MyClass(**params[i])` creates a valid test instance.
247+
``MyClass(**params)`` or ``MyClass(**params[i])`` creates a valid
248+
test instance.
248249
"""
249250
return {
250251
"start_level": 2,

aeon/anomaly_detection/series/outlier_detection/_iforest.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ class IsolationForest(PyODAdapter):
1616
1717
This class implements the Isolation Forest algorithm for anomaly detection
1818
using PyODAdadpter to be used in the aeon framework. All parameters are passed to
19-
the PyOD model ``IForest`` except for `window_size` and `stride`, which are used to
20-
construct the sliding windows.
19+
the PyOD model ``IForest`` except for ``window_size`` and ``stride``,
20+
which are used to construct the sliding windows.
2121
2222
The documentation for parameters has been adapted from the
2323
[PyOD documentation](https://pyod.readthedocs.io/en/latest/pyod.models.html#id405).
24-
Here, `X` refers to the set of sliding windows extracted from the time series
24+
Here, ``X`` refers to the set of sliding windows extracted from the time series
2525
using :func:`aeon.utils.windowing.sliding_windows` with the parameters
26-
``window_size`` and ``stride``. The internal `X` has the shape
27-
`(n_windows, window_size * n_channels)`.
26+
``window_size`` and ``stride``. The internal ``X`` has the shape
27+
``(n_windows, window_size * n_channels)``.
2828
2929
Parameters
3030
----------
@@ -34,34 +34,34 @@ class IsolationForest(PyODAdapter):
3434
max_samples : int, float or "auto", default="auto"
3535
The number of samples to draw from X to train each base estimator.
3636
37-
- If int, then draw `max_samples` samples.
38-
- If float, then draw `max_samples * X.shape[0]` samples.
39-
- If "auto", then `max_samples=min(256, n_samples)`.
37+
- If ``int``, then draw ``max_samples`` samples.
38+
- If ``float``, then draw ``max_samples * X.shape[0]`` samples.
39+
- If ``"auto"``, then ``max_samples=min(256, n_samples)``.
4040
4141
If max_samples is larger than the number of samples provided,
4242
all samples will be used for all trees (no sampling).
4343
4444
max_features : int or float, default=1.0
4545
The number of features to draw from X to train each base estimator.
4646
47-
- If int, then draw `max_features` features.
48-
- If float, then draw `max_features * X.shape[1]` features.
47+
- If ``int``, then draw ``max_features`` features.
48+
- If ``float``, then draw ``max_features * X.shape[1]`` features.
4949
5050
bootstrap : bool, default=False
51-
If True, individual trees are fit on random subsets of the training
51+
If ``True``, individual trees are fit on random subsets of the training
5252
data sampled with replacement. If False, sampling without replacement
5353
is performed.
5454
5555
n_jobs : int, default=1
56-
The number of jobs to run in parallel for both `fit` and `predict`.
57-
If -1, then the number of jobs is set to the number of cores.
56+
The number of jobs to run in parallel for both ``fit`` and ``predict``.
57+
If ``-1``, then the number of jobs is set to the number of cores.
5858
5959
6060
random_state : int, np.RandomState or None, default=None
61-
If int, random_state is the seed used by the random number generator;
61+
If ``int``, random_state is the seed used by the random number generator;
6262
If RandomState instance, random_state is the random number generator;
63-
If None, the random number generator is the RandomState instance used
64-
by `np.random`.
63+
If ``None``, the random number generator is the RandomState instance used
64+
by ``np.random``.
6565
6666
verbose : int, default=0
6767
Controls the verbosity of the tree building process.
@@ -138,14 +138,14 @@ def _get_test_params(cls, parameter_set="default"):
138138
----------
139139
parameter_set : str, default="default"
140140
Name of the set of test parameters to return, for use in tests. If no
141-
special parameters are defined for a value, will return `"default"` set.
141+
special parameters are defined for a value, will return ``"default"`` set.
142142
143143
Returns
144144
-------
145145
params : dict
146146
Parameters to create testing instances of the class.
147147
Each dict are parameters to construct an "interesting" test instance, i.e.,
148-
`IsolationForest(**params)` creates a valid test instance.
148+
``IsolationForest(**params)`` creates a valid test instance.
149149
"""
150150
return {
151151
"n_estimators": 10,

aeon/anomaly_detection/series/outlier_detection/_one_class_svm.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ class OneClassSVM(BaseSeriesAnomalyDetector):
1616
1717
This class implements the OneClassSVM algorithm for anomaly detection
1818
from sklearn to be used in the aeon framework. All parameters are passed to
19-
the sklearn ``OneClassSVM`` except for `window_size` and `stride`, which are used to
20-
construct the sliding windows.
19+
the sklearn ``OneClassSVM`` except for ``window_size`` and ``stride``,
20+
which are used to construct the sliding windows.
2121
2222
The documentation for parameters has been adapted from
2323
(https://scikit-learn.org/dev/modules/generated/sklearn.svm.OneClassSVM.html).
24-
Here, `X` refers to the set of sliding windows extracted from the time series
24+
Here, ``X`` refers to the set of sliding windows extracted from the time series
2525
using :func:`aeon.utils.windowing.sliding_windows` with the parameters
26-
``window_size`` and ``stride``. The internal `X` has the shape
27-
`(n_windows, window_size * n_channels)`.
26+
``window_size`` and ``stride``. The internal ``X`` has the shape
27+
``(n_windows, window_size * n_channels)``.
2828
2929
Parameters
3030
----------
@@ -43,8 +43,8 @@ class OneClassSVM(BaseSeriesAnomalyDetector):
4343
4444
- if ``gamma='scale'`` (default) is passed then it uses
4545
1 / (n_features * X.var()) as value of gamma,
46-
- if 'auto', uses 1 / n_features
47-
- if float, must be non-negative.
46+
- if ``"auto"``, uses 1 / n_features
47+
- if ``float``, must be non-negative.
4848
4949
.. versionchanged:: 0.22
5050
The default value of ``gamma`` changed from 'auto' to 'scale'.

0 commit comments

Comments
 (0)