Skip to content

[DOC] resolved the inconsistency of double ticks for the anomaly detection module #809 #2546

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
ea51d19
resolved the inconsistency of double quotes
AnaghDeshpande Feb 19, 2025
935af19
resolved the inconsistency of double ticks
AnaghDeshpande Feb 20, 2025
e7d46a0
resolved the pre-commit errors occuring due to flake8
AnaghDeshpande Feb 21, 2025
8c6b92c
Update _cblof.py
AnaghDeshpande Feb 21, 2025
139e2a7
Automatic `pre-commit` fixes
AnaghDeshpande Feb 21, 2025
dce8ca2
Update _copod.py
AnaghDeshpande Feb 21, 2025
067dade
Automatic `pre-commit` fixes
AnaghDeshpande Feb 21, 2025
603d0fa
Update _iforest.py
AnaghDeshpande Feb 21, 2025
0c3c30c
Automatic `pre-commit` fixes
AnaghDeshpande Feb 21, 2025
f6e163f
Update _kmeans.py
AnaghDeshpande Feb 21, 2025
1d1e295
Automatic `pre-commit` fixes
AnaghDeshpande Feb 21, 2025
3a9a738
Update _merlin.py
AnaghDeshpande Feb 21, 2025
53554ab
Automatic `pre-commit` fixes
AnaghDeshpande Feb 21, 2025
9ab38d8
Update _one_class_svm.py
AnaghDeshpande Feb 21, 2025
0f7173c
Automatic `pre-commit` fixes
AnaghDeshpande Feb 21, 2025
63daa5f
Update _pyodadapter.py
AnaghDeshpande Feb 21, 2025
3937b54
Update _stomp.py
AnaghDeshpande Feb 21, 2025
40d63ae
Automatic `pre-commit` fixes
AnaghDeshpande Feb 21, 2025
5421e56
Merge branch 'main' into fix/inconsistent-double-quotes
patrickzib Feb 23, 2025
c0c43bd
converted directives to single ticks
AnaghDeshpande Feb 25, 2025
a6208c1
added double ticks to code ref
AnaghDeshpande Feb 25, 2025
85e1147
Merge branch 'fix/inconsistent-double-quotes' of https://github.com/A…
AnaghDeshpande Feb 25, 2025
167c98a
fixed link in cblof.py and some other minor changes
AnaghDeshpande Feb 27, 2025
b9c92c8
Merge branch 'main' into fix/inconsistent-double-quotes
AnaghDeshpande Apr 4, 2025
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
32 changes: 17 additions & 15 deletions aeon/anomaly_detection/_cblof.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@ class CBLOF(PyODAdapter):

This class implements the CBLOF algorithm for anomaly detection
using PyODAdadpter to be used in the aeon framework. All parameters are passed to
the PyOD model ``CBLOF`` except for `window_size` and `stride`, which are used to
construct the sliding windows.
the PyOD model ``CBLOF`` except for ``window_size`` and ``stride``,
which are used to construct the sliding windows.

The documentation for parameters has been adapted from the
[PyOD documentation](https://pyod.readthedocs.io/en/latest/pyod.models.html#id117).
Here, `X` refers to the set of sliding windows extracted from the time series
`PyOD documentation <https://pyod.readthedocs.io/en/latest/pyod.models.html#id117>`_

Here, ``X`` refers to the set of sliding windows extracted from the time series
using :func:`aeon.utils.windowing.sliding_windows` with the parameters
``window_size`` and ``stride``. The internal `X` has the shape
`(n_windows, window_size * n_channels)`.
``window_size`` and ``stride``. The internal ``X`` has the shape
``(n_windows, window_size * n_channels)``.

Parameters
----------
Expand Down Expand Up @@ -52,21 +53,21 @@ class CBLOF(PyODAdapter):

beta : int or float in (1,), default=5
Coefficient for deciding small and large clusters. For a list
sorted clusters by size `|C1|, \|C2|, ..., |Cn|, beta = |Ck|/|Ck-1|`
sorted clusters by size ``|C1|, |C2|, ..., |Cn|, beta = |Ck|/|Ck-1|``

use_weights : bool, default=False
If set to True, the size of clusters are used as weights in
If set to ``True``, the size of clusters are used as weights in
outlier score calculation.

check_estimator : bool, default=False
If set to True, check whether the base estimator is consistent with
If set to ``True``, check whether the base estimator is consistent with
sklearn standard.

random_state : int, np.RandomState or None, default=None
If int, random_state is the seed used by the random
If ``int``, random_state is the seed used by the random
number generator; If RandomState instance, random_state is the random
number generator; If None, the random number generator is the
RandomState instance used by `np.random`.
number generator; If ``None``, the random number generator is the
RandomState instance used by ``np.random``.

window_size : int, default=10
Size of the sliding window.
Expand Down Expand Up @@ -135,15 +136,16 @@ def _get_test_params(cls, parameter_set="default"):
----------
parameter_set : str, default="default"
Name of the set of test parameters to return, for use in tests. If no
special parameters are defined for a value, will return `"default"` set.
special parameters are defined for a value, will return ``"default"`` set.

Returns
-------
params : dict
Parameters to create testing instances of the class.
Each dict are parameters to construct an "interesting" test instance, i.e.,
`MyClass(**params)` or `MyClass(**params[i])` creates a valid test instance.
`create_test_instance` uses the first (or only) dictionary in `params`.
``MyClass(**params)`` or ``MyClass(**params[i])`` creates a valid test
instance. ``create_test_instance`` uses the first (or only) dictionary
in ``params``.
"""
return {
"n_clusters": 4,
Expand Down
11 changes: 6 additions & 5 deletions aeon/anomaly_detection/_copod.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ class COPOD(PyODAdapter):
"""COPOD for anomaly detection.

This class implements the COPOD using PyODAdadpter to be used in the aeon framework.
The parameter `n_jobs` is passed to COPOD model from PyOD, `window_size` and
`stride` are used to construct the sliding windows.
The parameter ``n_jobs`` is passed to COPOD model from PyOD, ``window_size`` and
``stride`` are used to construct the sliding windows.

Parameters
----------
Expand Down Expand Up @@ -66,14 +66,15 @@ def _get_test_params(cls, parameter_set="default") -> dict:
----------
parameter_set : str, default="default"
Name of the set of test parameters to return, for use in tests. If no
special parameters are defined for a value, will return `"default"` set.
special parameters are defined for a value, will return ``"default"`` set.

Returns
-------
params : dict or list of dict, default={}
Parameters to create testing instances of the class.
Each dict are parameters to construct an "interesting" test instance, i.e.,
`MyClass(**params)` or `MyClass(**params[i])` creates a valid test instance.
`create_test_instance` uses the first (or only) dictionary in `params`.
``MyClass(**params)`` or ``MyClass(**params[i])`` creates a valid test
instance. ``create_test_instance`` uses the first (or only) dictionary
in ``params``.
"""
return {}
5 changes: 3 additions & 2 deletions aeon/anomaly_detection/_dwt_mlead.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,14 +235,15 @@ def _get_test_params(cls, parameter_set="default"):
----------
parameter_set : str, default="default"
Name of the set of test parameters to return, for use in tests. If no
special parameters are defined for a value, will return `"default"` set.
special parameters are defined for a value, will return ``"default"`` set.

Returns
-------
params : dict or list of dict, default={}
Parameters to create testing instances of the class.
Each dict are parameters to construct an "interesting" test instance, i.e.,
`MyClass(**params)` or `MyClass(**params[i])` creates a valid test instance.
``MyClass(**params)`` or ``MyClass(**params[i])`` creates a valid
test instance.
"""
return {
"start_level": 2,
Expand Down
36 changes: 18 additions & 18 deletions aeon/anomaly_detection/_iforest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ class IsolationForest(PyODAdapter):

This class implements the Isolation Forest algorithm for anomaly detection
using PyODAdadpter to be used in the aeon framework. All parameters are passed to
the PyOD model ``IForest`` except for `window_size` and `stride`, which are used to
construct the sliding windows.
the PyOD model ``IForest`` except for ``window_size`` and ``stride``,
which are used to construct the sliding windows.

The documentation for parameters has been adapted from the
[PyOD documentation](https://pyod.readthedocs.io/en/latest/pyod.models.html#id405).
Here, `X` refers to the set of sliding windows extracted from the time series
Here, ``X`` refers to the set of sliding windows extracted from the time series
using :func:`aeon.utils.windowing.sliding_windows` with the parameters
``window_size`` and ``stride``. The internal `X` has the shape
`(n_windows, window_size * n_channels)`.
``window_size`` and ``stride``. The internal ``X`` has the shape
``(n_windows, window_size * n_channels)``.

Parameters
----------
Expand All @@ -34,34 +34,34 @@ class IsolationForest(PyODAdapter):
max_samples : int, float or "auto", default="auto"
The number of samples to draw from X to train each base estimator.

- If int, then draw `max_samples` samples.
- If float, then draw `max_samples * X.shape[0]` samples.
- If "auto", then `max_samples=min(256, n_samples)`.
- If ``int``, then draw ``max_samples`` samples.
- If ``float``, then draw ``max_samples * X.shape[0]`` samples.
- If ``"auto"``, then ``max_samples=min(256, n_samples)``.

If max_samples is larger than the number of samples provided,
all samples will be used for all trees (no sampling).

max_features : int or float, default=1.0
The number of features to draw from X to train each base estimator.

- If int, then draw `max_features` features.
- If float, then draw `max_features * X.shape[1]` features.
- If ``int``, then draw ``max_features`` features.
- If ``float``, then draw ``max_features * X.shape[1]`` features.

bootstrap : bool, default=False
If True, individual trees are fit on random subsets of the training
If ``True``, individual trees are fit on random subsets of the training
data sampled with replacement. If False, sampling without replacement
is performed.

n_jobs : int, default=1
The number of jobs to run in parallel for both `fit` and `predict`.
If -1, then the number of jobs is set to the number of cores.
The number of jobs to run in parallel for both ``fit`` and ``predict``.
If ``-1``, then the number of jobs is set to the number of cores.


random_state : int, np.RandomState or None, default=None
If int, random_state is the seed used by the random number generator;
If ``int``, random_state is the seed used by the random number generator;
If RandomState instance, random_state is the random number generator;
If None, the random number generator is the RandomState instance used
by `np.random`.
If ``None``, the random number generator is the RandomState instance used
by ``np.random``.

verbose : int, default=0
Controls the verbosity of the tree building process.
Expand Down Expand Up @@ -135,14 +135,14 @@ def _get_test_params(cls, parameter_set="default"):
----------
parameter_set : str, default="default"
Name of the set of test parameters to return, for use in tests. If no
special parameters are defined for a value, will return `"default"` set.
special parameters are defined for a value, will return ``"default"`` set.

Returns
-------
params : dict
Parameters to create testing instances of the class.
Each dict are parameters to construct an "interesting" test instance, i.e.,
`IsolationForest(**params)` creates a valid test instance.
``IsolationForest(**params)`` creates a valid test instance.
"""
return {
"n_estimators": 10,
Expand Down
5 changes: 3 additions & 2 deletions aeon/anomaly_detection/_kmeans.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,15 @@ def _get_test_params(cls, parameter_set="default"):
----------
parameter_set : str, default="default"
Name of the set of test parameters to return, for use in tests. If no
special parameters are defined for a value, will return `"default"` set.
special parameters are defined for a value, will return ``"default"`` set.

Returns
-------
dict or list of dict, default={}
Parameters to create testing instances of the class.
Each dict are parameters to construct an "interesting" test instance, i.e.,
`MyClass(**params)` or `MyClass(**params[i])` creates a valid test instance.
``MyClass(**params)`` or ``MyClass(**params[i])`` creates a valid
test instance.
"""
return {
"n_clusters": 5,
Expand Down
12 changes: 6 additions & 6 deletions aeon/anomaly_detection/_lof.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ class LOF(PyODAdapter):

The documentation for parameters has been adapted from the
[PyOD documentation](https://pyod.readthedocs.io/en/latest/pyod.models.html#id586).
Here, `X` refers to the set of sliding windows extracted from the time series
Here, ``X`` refers to the set of sliding windows extracted from the time series
using :func:`aeon.utils.windowing.sliding_windows` with the parameters
``window_size`` and ``stride``. The internal `X` has the shape
`(n_windows, window_size * n_channels)`.
``window_size`` and ``stride``. The internal ``X`` has the shape
``(n_windows, window_size * n_channels)``.

Parameters
----------
n_neighbors : int, optional (default=20)
Number of neighbors to use by default for `kneighbors` queries.
Number of neighbors to use by default for ``kneighbors`` queries.
If n_neighbors is larger than the number of samples provided,
all samples will be used.
algorithm : {'auto', 'ball_tree', 'kd_tree', 'brute'}, optional
Expand All @@ -36,11 +36,11 @@ class LOF(PyODAdapter):
- 'kd_tree' will use KDTree
- 'brute' will use a brute-force search.
- 'auto' will attempt to decide the most appropriate algorithm
based on the values passed to :meth:`fit` method.
based on the values passed to :meth:``fit`` method.
Note: fitting on sparse input will override the setting of
this parameter, using brute force.
leaf_size : int, optional (default=30)
Leaf size passed to `BallTree` or `KDTree`. This can
Leaf size passed to ``BallTree`` or ``KDTree``. This can
affect the speed of the construction and query, as well as the memory
required to store the tree. The optimal value depends on the
nature of the problem.
Expand Down
5 changes: 3 additions & 2 deletions aeon/anomaly_detection/_merlin.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,14 @@ def _get_test_params(cls, parameter_set="default"):
----------
parameter_set : str, default="default"
Name of the set of test parameters to return, for use in tests. If no
special parameters are defined for a value, will return `"default"` set.
special parameters are defined for a value, will return ``"default"`` set.

Returns
-------
params : dict or list of dict, default={}
Parameters to create testing instances of the class.
Each dict are parameters to construct an "interesting" test instance, i.e.,
`MyClass(**params)` or `MyClass(**params[i])` creates a valid test instance.
``MyClass(**params)`` or ``MyClass(**params[i])`` creates a valid
test instance.
"""
return {"min_length": 4, "max_length": 7}
14 changes: 7 additions & 7 deletions aeon/anomaly_detection/_one_class_svm.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ class OneClassSVM(BaseAnomalyDetector):

This class implements the OneClassSVM algorithm for anomaly detection
from sklearn to be used in the aeon framework. All parameters are passed to
the sklearn ``OneClassSVM`` except for `window_size` and `stride`, which are used to
construct the sliding windows.
the sklearn ``OneClassSVM`` except for ``window_size`` and ``stride``,
which are used to construct the sliding windows.

The documentation for parameters has been adapted from
(https://scikit-learn.org/dev/modules/generated/sklearn.svm.OneClassSVM.html).
Here, `X` refers to the set of sliding windows extracted from the time series
Here, ``X`` refers to the set of sliding windows extracted from the time series
using :func:`aeon.utils.windowing.sliding_windows` with the parameters
``window_size`` and ``stride``. The internal `X` has the shape
`(n_windows, window_size * n_channels)`.
``window_size`` and ``stride``. The internal ``X`` has the shape
``(n_windows, window_size * n_channels)``.

Parameters
----------
Expand All @@ -43,8 +43,8 @@ class OneClassSVM(BaseAnomalyDetector):

- if ``gamma='scale'`` (default) is passed then it uses
1 / (n_features * X.var()) as value of gamma,
- if 'auto', uses 1 / n_features
- if float, must be non-negative.
- if ``"auto"``, uses 1 / n_features
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the only one, but I'm not sure I agree to using both quotes " and ``

- if ``float``, must be non-negative.

.. versionchanged:: 0.22
The default value of ``gamma`` changed from 'auto' to 'scale'.
Expand Down
11 changes: 6 additions & 5 deletions aeon/anomaly_detection/_pyodadapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ class PyODAdapter(BaseAnomalyDetector):
target time series with the same number of dimensions. The reference (or training)
time series does not need to be clean for most PyOD models. However, knowledge in
form of anomaly labels about the potential existing anomalies in the reference time
series are not used during the fitting process. Use `fit` to fit the model on the
reference time series and `predict` to detect anomalies in the target time series.
For unsupervised anomaly detection, use `fit_predict` directly on the target time
series are not used during the fitting process. Use ``fit`` to fit the model on the
reference time series and ``predict`` to detect anomalies in the target time series.
For unsupervised anomaly detection, use ``fit_predict`` directly on the target time
series.


Expand Down Expand Up @@ -155,14 +155,15 @@ def _get_test_params(cls, parameter_set="default"):
----------
parameter_set : str, default="default"
Name of the set of test parameters to return, for use in tests. If no
special parameters are defined for a value, will return `"default"` set.
special parameters are defined for a value, will return ``"default"`` set.

Returns
-------
params : dict or list of dict, default={}
Parameters to create testing instances of the class.
Each dict are parameters to construct an "interesting" test instance, i.e.,
`MyClass(**params)` or `MyClass(**params[i])` creates a valid test instance.
``MyClass(**params)`` or ``MyClass(**params[i])`` creates a valid
test instance.
"""
_check_soft_dependencies(*cls._tags["python_dependencies"])

Expand Down
5 changes: 3 additions & 2 deletions aeon/anomaly_detection/_stomp.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,15 @@ def _get_test_params(cls, parameter_set="default"):
----------
parameter_set : str, default="default"
Name of the set of test parameters to return, for use in tests. If no
special parameters are defined for a value, will return `"default"` set.
special parameters are defined for a value, will return ``"default"`` set.

Returns
-------
params : dict or list of dict, default={}
Parameters to create testing instances of the class.
Each dict are parameters to construct an "interesting" test instance, i.e.,
`MyClass(**params)` or `MyClass(**params[i])` creates a valid test instance.
``MyClass(**params)`` or ``MyClass(**params[i])`` creates a valid
test instance.
"""
return {
"window_size": 10,
Expand Down
Loading