diff --git a/aeon/anomaly_detection/__init__.py b/aeon/anomaly_detection/__init__.py index c1f87846e7..65343cd774 100644 --- a/aeon/anomaly_detection/__init__.py +++ b/aeon/anomaly_detection/__init__.py @@ -1,31 +1,7 @@ """Time Series Anomaly Detection.""" __all__ = [ - "CBLOF", - "COPOD", - "DWT_MLEAD", - "IsolationForest", - "KMeansAD", - "LeftSTAMPi", - "LOF", - "MERLIN", - "OneClassSVM", - "ROCKAD", - "PyODAdapter", - "STOMP", - "STRAY", + "BaseAnomalyDetector", ] -from aeon.anomaly_detection._cblof import CBLOF -from aeon.anomaly_detection._copod import COPOD -from aeon.anomaly_detection._dwt_mlead import DWT_MLEAD -from aeon.anomaly_detection._iforest import IsolationForest -from aeon.anomaly_detection._kmeans import KMeansAD -from aeon.anomaly_detection._left_stampi import LeftSTAMPi -from aeon.anomaly_detection._lof import LOF -from aeon.anomaly_detection._merlin import MERLIN -from aeon.anomaly_detection._one_class_svm import OneClassSVM -from aeon.anomaly_detection._pyodadapter import PyODAdapter -from aeon.anomaly_detection._rockad import ROCKAD -from aeon.anomaly_detection._stomp import STOMP -from aeon.anomaly_detection._stray import STRAY +from aeon.anomaly_detection.base import BaseAnomalyDetector diff --git a/aeon/anomaly_detection/distance_based/__init__.py b/aeon/anomaly_detection/distance_based/__init__.py new file mode 100644 index 0000000000..5eb342b780 --- /dev/null +++ b/aeon/anomaly_detection/distance_based/__init__.py @@ -0,0 +1,19 @@ +"""Distance basedTime Series Anomaly Detection.""" + +__all__ = [ + "CBLOF", + "KMeansAD", + "LeftSTAMPi", + "LOF", + "MERLIN", + "OneClassSVM", + "STOMP", +] + +from aeon.anomaly_detection.distance_based._cblof import CBLOF +from aeon.anomaly_detection.distance_based._kmeans import KMeansAD +from aeon.anomaly_detection.distance_based._left_stampi import LeftSTAMPi +from aeon.anomaly_detection.distance_based._lof import LOF +from aeon.anomaly_detection.distance_based._merlin import MERLIN +from aeon.anomaly_detection.distance_based._one_class_svm import OneClassSVM +from aeon.anomaly_detection.distance_based._stomp import STOMP diff --git a/aeon/anomaly_detection/_cblof.py b/aeon/anomaly_detection/distance_based/_cblof.py similarity index 98% rename from aeon/anomaly_detection/_cblof.py rename to aeon/anomaly_detection/distance_based/_cblof.py index 506974f6ca..18bb044c14 100644 --- a/aeon/anomaly_detection/_cblof.py +++ b/aeon/anomaly_detection/distance_based/_cblof.py @@ -7,7 +7,7 @@ import numpy as np -from aeon.anomaly_detection._pyodadapter import PyODAdapter +from aeon.anomaly_detection.outlier_detection._pyodadapter import PyODAdapter from aeon.utils.validation._dependencies import _check_soft_dependencies diff --git a/aeon/anomaly_detection/_kmeans.py b/aeon/anomaly_detection/distance_based/_kmeans.py similarity index 99% rename from aeon/anomaly_detection/_kmeans.py rename to aeon/anomaly_detection/distance_based/_kmeans.py index c114911c3b..bb8f188a1d 100644 --- a/aeon/anomaly_detection/_kmeans.py +++ b/aeon/anomaly_detection/distance_based/_kmeans.py @@ -65,7 +65,7 @@ class KMeansAD(BaseAnomalyDetector): Examples -------- >>> import numpy as np - >>> from aeon.anomaly_detection import KMeansAD + >>> from aeon.anomaly_detection.distance_based import KMeansAD >>> X = np.array([1, 2, 3, 4, 1, 2, 3, 3, 2, 8, 9, 8, 1, 2, 3, 4], dtype=np.float64) >>> detector = KMeansAD(n_clusters=3, window_size=4, stride=1, random_state=0) >>> detector.fit_predict(X) diff --git a/aeon/anomaly_detection/_left_stampi.py b/aeon/anomaly_detection/distance_based/_left_stampi.py similarity index 98% rename from aeon/anomaly_detection/_left_stampi.py rename to aeon/anomaly_detection/distance_based/_left_stampi.py index d71cc5bd26..43078ce021 100644 --- a/aeon/anomaly_detection/_left_stampi.py +++ b/aeon/anomaly_detection/distance_based/_left_stampi.py @@ -44,7 +44,7 @@ class LeftSTAMPi(BaseAnomalyDetector): Internally,this is applying the incremental approach outlined below. >>> import numpy as np # doctest: +SKIP - >>> from aeon.anomaly_detection import LeftSTAMPi # doctest: +SKIP + >>> from aeon.anomaly_detection.distance_based import LeftSTAMPi # doctest: +SKIP >>> X = np.random.default_rng(42).random((10)) # doctest: +SKIP >>> detector = LeftSTAMPi(window_size=3, n_init_train=3) # doctest: +SKIP >>> detector.fit_predict(X) # doctest: +SKIP diff --git a/aeon/anomaly_detection/_lof.py b/aeon/anomaly_detection/distance_based/_lof.py similarity index 98% rename from aeon/anomaly_detection/_lof.py rename to aeon/anomaly_detection/distance_based/_lof.py index 99ac068584..2c3615d906 100644 --- a/aeon/anomaly_detection/_lof.py +++ b/aeon/anomaly_detection/distance_based/_lof.py @@ -7,7 +7,7 @@ import numpy as np -from aeon.anomaly_detection._pyodadapter import PyODAdapter +from aeon.anomaly_detection.outlier_detection._pyodadapter import PyODAdapter from aeon.utils.validation._dependencies import _check_soft_dependencies diff --git a/aeon/anomaly_detection/_merlin.py b/aeon/anomaly_detection/distance_based/_merlin.py similarity index 99% rename from aeon/anomaly_detection/_merlin.py rename to aeon/anomaly_detection/distance_based/_merlin.py index 5928d156d6..b63224acd5 100644 --- a/aeon/anomaly_detection/_merlin.py +++ b/aeon/anomaly_detection/distance_based/_merlin.py @@ -43,7 +43,7 @@ class MERLIN(BaseAnomalyDetector): Examples -------- >>> import numpy as np - >>> from aeon.anomaly_detection import MERLIN + >>> from aeon.anomaly_detection.distance_based import MERLIN >>> X = np.array([1, 2, 3, 4, 1, 2, 3, 4, 2, 3, 4, 5, 1, 2, 3, 4]) >>> detector = MERLIN(min_length=4, max_length=5) >>> detector.fit_predict(X) diff --git a/aeon/anomaly_detection/_one_class_svm.py b/aeon/anomaly_detection/distance_based/_one_class_svm.py similarity index 100% rename from aeon/anomaly_detection/_one_class_svm.py rename to aeon/anomaly_detection/distance_based/_one_class_svm.py diff --git a/aeon/anomaly_detection/_stomp.py b/aeon/anomaly_detection/distance_based/_stomp.py similarity index 98% rename from aeon/anomaly_detection/_stomp.py rename to aeon/anomaly_detection/distance_based/_stomp.py index af39891149..3f8be36432 100644 --- a/aeon/anomaly_detection/_stomp.py +++ b/aeon/anomaly_detection/distance_based/_stomp.py @@ -38,7 +38,7 @@ class STOMP(BaseAnomalyDetector): Examples -------- >>> import numpy as np - >>> from aeon.anomaly_detection import STOMP # doctest: +SKIP + >>> from aeon.anomaly_detection.distance_based import STOMP # doctest: +SKIP >>> X = np.random.default_rng(42).random((10, 2), dtype=np.float64) >>> detector = STOMP(X, window_size=2) # doctest: +SKIP >>> detector.fit_predict(X, axis=0) # doctest: +SKIP diff --git a/aeon/anomaly_detection/distance_based/tests/__init__.py b/aeon/anomaly_detection/distance_based/tests/__init__.py new file mode 100644 index 0000000000..03b6c4a5e8 --- /dev/null +++ b/aeon/anomaly_detection/distance_based/tests/__init__.py @@ -0,0 +1 @@ +"""Distance based test code.""" diff --git a/aeon/anomaly_detection/tests/test_cblof.py b/aeon/anomaly_detection/distance_based/tests/test_cblof.py similarity index 97% rename from aeon/anomaly_detection/tests/test_cblof.py rename to aeon/anomaly_detection/distance_based/tests/test_cblof.py index 090ef98064..d1472af6a2 100644 --- a/aeon/anomaly_detection/tests/test_cblof.py +++ b/aeon/anomaly_detection/distance_based/tests/test_cblof.py @@ -3,7 +3,7 @@ import numpy as np import pytest -from aeon.anomaly_detection import CBLOF +from aeon.anomaly_detection.distance_based import CBLOF from aeon.testing.data_generation import make_example_1d_numpy from aeon.utils.validation._dependencies import _check_soft_dependencies diff --git a/aeon/anomaly_detection/tests/test_kmeans.py b/aeon/anomaly_detection/distance_based/tests/test_kmeans.py similarity index 96% rename from aeon/anomaly_detection/tests/test_kmeans.py rename to aeon/anomaly_detection/distance_based/tests/test_kmeans.py index 9812d7696b..2647411b88 100644 --- a/aeon/anomaly_detection/tests/test_kmeans.py +++ b/aeon/anomaly_detection/distance_based/tests/test_kmeans.py @@ -6,7 +6,7 @@ import pytest from sklearn.utils import check_random_state -from aeon.anomaly_detection import KMeansAD +from aeon.anomaly_detection.distance_based import KMeansAD def test_kmeansad_univariate(): diff --git a/aeon/anomaly_detection/tests/test_left_stampi.py b/aeon/anomaly_detection/distance_based/tests/test_left_stampi.py similarity index 99% rename from aeon/anomaly_detection/tests/test_left_stampi.py rename to aeon/anomaly_detection/distance_based/tests/test_left_stampi.py index 589d163f7b..6444bccdfe 100644 --- a/aeon/anomaly_detection/tests/test_left_stampi.py +++ b/aeon/anomaly_detection/distance_based/tests/test_left_stampi.py @@ -8,7 +8,7 @@ import numpy as np import pytest -from aeon.anomaly_detection._left_stampi import LeftSTAMPi +from aeon.anomaly_detection.distance_based._left_stampi import LeftSTAMPi from aeon.testing.data_generation import make_example_1d_numpy from aeon.utils.validation._dependencies import _check_soft_dependencies diff --git a/aeon/anomaly_detection/tests/test_lof.py b/aeon/anomaly_detection/distance_based/tests/test_lof.py similarity index 99% rename from aeon/anomaly_detection/tests/test_lof.py rename to aeon/anomaly_detection/distance_based/tests/test_lof.py index 846aa78a5a..033d11295b 100644 --- a/aeon/anomaly_detection/tests/test_lof.py +++ b/aeon/anomaly_detection/distance_based/tests/test_lof.py @@ -3,7 +3,7 @@ import numpy as np import pytest -from aeon.anomaly_detection import LOF +from aeon.anomaly_detection.distance_based import LOF from aeon.testing.data_generation import make_example_1d_numpy from aeon.utils.validation._dependencies import _check_soft_dependencies diff --git a/aeon/anomaly_detection/tests/test_merlin.py b/aeon/anomaly_detection/distance_based/tests/test_merlin.py similarity index 96% rename from aeon/anomaly_detection/tests/test_merlin.py rename to aeon/anomaly_detection/distance_based/tests/test_merlin.py index 20fe7c697e..ccf7e3300d 100644 --- a/aeon/anomaly_detection/tests/test_merlin.py +++ b/aeon/anomaly_detection/distance_based/tests/test_merlin.py @@ -4,7 +4,7 @@ import numpy as np -from aeon.anomaly_detection import MERLIN +from aeon.anomaly_detection.distance_based import MERLIN TEST_DATA = np.array( [ diff --git a/aeon/anomaly_detection/tests/test_one_class_svm.py b/aeon/anomaly_detection/distance_based/tests/test_one_class_svm.py similarity index 95% rename from aeon/anomaly_detection/tests/test_one_class_svm.py rename to aeon/anomaly_detection/distance_based/tests/test_one_class_svm.py index c99f0ff755..7a3aca2042 100644 --- a/aeon/anomaly_detection/tests/test_one_class_svm.py +++ b/aeon/anomaly_detection/distance_based/tests/test_one_class_svm.py @@ -4,7 +4,7 @@ import pytest from sklearn.utils import check_random_state -from aeon.anomaly_detection import OneClassSVM +from aeon.anomaly_detection.distance_based import OneClassSVM def test_one_class_svm_univariate(): diff --git a/aeon/anomaly_detection/tests/test_stomp.py b/aeon/anomaly_detection/distance_based/tests/test_stomp.py similarity index 95% rename from aeon/anomaly_detection/tests/test_stomp.py rename to aeon/anomaly_detection/distance_based/tests/test_stomp.py index b1adfc1d12..b506c89ea0 100644 --- a/aeon/anomaly_detection/tests/test_stomp.py +++ b/aeon/anomaly_detection/distance_based/tests/test_stomp.py @@ -6,7 +6,7 @@ import pytest from sklearn.utils import check_random_state -from aeon.anomaly_detection import STOMP +from aeon.anomaly_detection.distance_based import STOMP from aeon.utils.validation._dependencies import _check_soft_dependencies diff --git a/aeon/anomaly_detection/distribution_based/__init__.py b/aeon/anomaly_detection/distribution_based/__init__.py new file mode 100644 index 0000000000..e52a7512ba --- /dev/null +++ b/aeon/anomaly_detection/distribution_based/__init__.py @@ -0,0 +1,9 @@ +"""Distribution based Time Series Anomaly Detection.""" + +__all__ = [ + "COPOD", + "DWT_MLEAD", +] + +from aeon.anomaly_detection.distribution_based._copod import COPOD +from aeon.anomaly_detection.distribution_based._dwt_mlead import DWT_MLEAD diff --git a/aeon/anomaly_detection/_copod.py b/aeon/anomaly_detection/distribution_based/_copod.py similarity index 97% rename from aeon/anomaly_detection/_copod.py rename to aeon/anomaly_detection/distribution_based/_copod.py index ee448b96b8..bd2af0e084 100644 --- a/aeon/anomaly_detection/_copod.py +++ b/aeon/anomaly_detection/distribution_based/_copod.py @@ -7,7 +7,7 @@ import numpy as np -from aeon.anomaly_detection._pyodadapter import PyODAdapter +from aeon.anomaly_detection.outlier_detection._pyodadapter import PyODAdapter from aeon.utils.validation._dependencies import _check_soft_dependencies diff --git a/aeon/anomaly_detection/_dwt_mlead.py b/aeon/anomaly_detection/distribution_based/_dwt_mlead.py similarity index 99% rename from aeon/anomaly_detection/_dwt_mlead.py rename to aeon/anomaly_detection/distribution_based/_dwt_mlead.py index e78bb1d7d9..cb0de0c015 100644 --- a/aeon/anomaly_detection/_dwt_mlead.py +++ b/aeon/anomaly_detection/distribution_based/_dwt_mlead.py @@ -78,7 +78,7 @@ class DWT_MLEAD(BaseAnomalyDetector): Examples -------- >>> import numpy as np - >>> from aeon.anomaly_detection import DWT_MLEAD + >>> from aeon.anomaly_detection.distribution_based import DWT_MLEAD >>> X = np.array([1, 2, 3, 4, 1, 2, 3, 3, 2, 8, 9, 8, 1, 2, 3, 4], dtype=np.float64) >>> detector = DWT_MLEAD( ... start_level=1, quantile_boundary_type='percentile', quantile_epsilon=0.01 diff --git a/aeon/anomaly_detection/distribution_based/tests/__init__.py b/aeon/anomaly_detection/distribution_based/tests/__init__.py new file mode 100644 index 0000000000..2f368970c0 --- /dev/null +++ b/aeon/anomaly_detection/distribution_based/tests/__init__.py @@ -0,0 +1 @@ +"""Distribution based test code.""" diff --git a/aeon/anomaly_detection/tests/test_copod.py b/aeon/anomaly_detection/distribution_based/tests/test_copod.py similarity index 96% rename from aeon/anomaly_detection/tests/test_copod.py rename to aeon/anomaly_detection/distribution_based/tests/test_copod.py index abd2aa995f..40969da0e7 100644 --- a/aeon/anomaly_detection/tests/test_copod.py +++ b/aeon/anomaly_detection/distribution_based/tests/test_copod.py @@ -3,7 +3,7 @@ import numpy as np import pytest -from aeon.anomaly_detection import COPOD +from aeon.anomaly_detection.distribution_based import COPOD from aeon.testing.data_generation import make_example_1d_numpy from aeon.utils.validation._dependencies import _check_soft_dependencies diff --git a/aeon/anomaly_detection/tests/test_dwt_mlead.py b/aeon/anomaly_detection/distribution_based/tests/test_dwt_mlead.py similarity index 96% rename from aeon/anomaly_detection/tests/test_dwt_mlead.py rename to aeon/anomaly_detection/distribution_based/tests/test_dwt_mlead.py index c5d09bddc2..664d715122 100644 --- a/aeon/anomaly_detection/tests/test_dwt_mlead.py +++ b/aeon/anomaly_detection/distribution_based/tests/test_dwt_mlead.py @@ -6,7 +6,7 @@ import pytest from sklearn.utils import check_random_state -from aeon.anomaly_detection import DWT_MLEAD +from aeon.anomaly_detection.distribution_based import DWT_MLEAD def test_dwt_mlead_output(): diff --git a/aeon/anomaly_detection/outlier_detection/__init__.py b/aeon/anomaly_detection/outlier_detection/__init__.py new file mode 100644 index 0000000000..ad9b7868e5 --- /dev/null +++ b/aeon/anomaly_detection/outlier_detection/__init__.py @@ -0,0 +1,11 @@ +"""Time Series Outlier Detection.""" + +__all__ = [ + "IsolationForest", + "PyODAdapter", + "STRAY", +] + +from aeon.anomaly_detection.outlier_detection._iforest import IsolationForest +from aeon.anomaly_detection.outlier_detection._pyodadapter import PyODAdapter +from aeon.anomaly_detection.outlier_detection._stray import STRAY diff --git a/aeon/anomaly_detection/_iforest.py b/aeon/anomaly_detection/outlier_detection/_iforest.py similarity index 98% rename from aeon/anomaly_detection/_iforest.py rename to aeon/anomaly_detection/outlier_detection/_iforest.py index a410c3542d..f13152d0e7 100644 --- a/aeon/anomaly_detection/_iforest.py +++ b/aeon/anomaly_detection/outlier_detection/_iforest.py @@ -7,7 +7,7 @@ import numpy as np -from aeon.anomaly_detection._pyodadapter import PyODAdapter +from aeon.anomaly_detection.outlier_detection._pyodadapter import PyODAdapter from aeon.utils.validation._dependencies import _check_soft_dependencies diff --git a/aeon/anomaly_detection/_pyodadapter.py b/aeon/anomaly_detection/outlier_detection/_pyodadapter.py similarity index 98% rename from aeon/anomaly_detection/_pyodadapter.py rename to aeon/anomaly_detection/outlier_detection/_pyodadapter.py index c520cc6f19..5a068857c6 100644 --- a/aeon/anomaly_detection/_pyodadapter.py +++ b/aeon/anomaly_detection/outlier_detection/_pyodadapter.py @@ -59,7 +59,9 @@ class PyODAdapter(BaseAnomalyDetector): -------- >>> import numpy as np >>> from pyod.models.lof import LOF # doctest: +SKIP - >>> from aeon.anomaly_detection import PyODAdapter # doctest: +SKIP + >>> from aeon.anomaly_detection.outlier_detection import ( + ... PyODAdapter + ... ) # doctest: +SKIP >>> X = np.random.default_rng(42).random((10, 2), dtype=np.float64) >>> detector = PyODAdapter(LOF(), window_size=2) # doctest: +SKIP >>> detector.fit_predict(X, axis=0) # doctest: +SKIP diff --git a/aeon/anomaly_detection/_stray.py b/aeon/anomaly_detection/outlier_detection/_stray.py similarity index 98% rename from aeon/anomaly_detection/_stray.py rename to aeon/anomaly_detection/outlier_detection/_stray.py index 2c5d669033..e7512e2d24 100644 --- a/aeon/anomaly_detection/_stray.py +++ b/aeon/anomaly_detection/outlier_detection/_stray.py @@ -54,7 +54,7 @@ class STRAY(BaseAnomalyDetector): Examples -------- - >>> from aeon.anomaly_detection import STRAY + >>> from aeon.anomaly_detection.outlier_detection import STRAY >>> from aeon.datasets import load_airline >>> import numpy as np >>> X = load_airline() diff --git a/aeon/anomaly_detection/outlier_detection/tests/__init__.py b/aeon/anomaly_detection/outlier_detection/tests/__init__.py new file mode 100644 index 0000000000..7ac2efbbaa --- /dev/null +++ b/aeon/anomaly_detection/outlier_detection/tests/__init__.py @@ -0,0 +1 @@ +"""Outlier based test code.""" diff --git a/aeon/anomaly_detection/tests/test_iforest.py b/aeon/anomaly_detection/outlier_detection/tests/test_iforest.py similarity index 98% rename from aeon/anomaly_detection/tests/test_iforest.py rename to aeon/anomaly_detection/outlier_detection/tests/test_iforest.py index 59c1121022..a66d1003fb 100644 --- a/aeon/anomaly_detection/tests/test_iforest.py +++ b/aeon/anomaly_detection/outlier_detection/tests/test_iforest.py @@ -4,7 +4,7 @@ import pytest from sklearn.utils import check_random_state -from aeon.anomaly_detection import IsolationForest +from aeon.anomaly_detection.outlier_detection import IsolationForest from aeon.utils.validation._dependencies import _check_soft_dependencies diff --git a/aeon/anomaly_detection/tests/test_pyod_adapter.py b/aeon/anomaly_detection/outlier_detection/tests/test_pyod_adapter.py similarity index 98% rename from aeon/anomaly_detection/tests/test_pyod_adapter.py rename to aeon/anomaly_detection/outlier_detection/tests/test_pyod_adapter.py index eff4d5b325..ee75078133 100644 --- a/aeon/anomaly_detection/tests/test_pyod_adapter.py +++ b/aeon/anomaly_detection/outlier_detection/tests/test_pyod_adapter.py @@ -6,7 +6,7 @@ import pytest from sklearn.utils import check_random_state -from aeon.anomaly_detection import PyODAdapter +from aeon.anomaly_detection.outlier_detection import PyODAdapter from aeon.utils.validation._dependencies import _check_soft_dependencies diff --git a/aeon/anomaly_detection/tests/test_stray.py b/aeon/anomaly_detection/outlier_detection/tests/test_stray.py similarity index 98% rename from aeon/anomaly_detection/tests/test_stray.py rename to aeon/anomaly_detection/outlier_detection/tests/test_stray.py index cbf6caabb3..8429a8a3c5 100644 --- a/aeon/anomaly_detection/tests/test_stray.py +++ b/aeon/anomaly_detection/outlier_detection/tests/test_stray.py @@ -5,7 +5,7 @@ import numpy as np from sklearn.preprocessing import MinMaxScaler -from aeon.anomaly_detection import STRAY +from aeon.anomaly_detection.outlier_detection import STRAY def test_default_1D(): diff --git a/aeon/anomaly_detection/whole_series/__init__.py b/aeon/anomaly_detection/whole_series/__init__.py new file mode 100644 index 0000000000..7098b8cd08 --- /dev/null +++ b/aeon/anomaly_detection/whole_series/__init__.py @@ -0,0 +1,7 @@ +"""Whole Time Series Anomaly Detection.""" + +__all__ = [ + "ROCKAD", +] + +from aeon.anomaly_detection.whole_series._rockad import ROCKAD diff --git a/aeon/anomaly_detection/_rockad.py b/aeon/anomaly_detection/whole_series/_rockad.py similarity index 100% rename from aeon/anomaly_detection/_rockad.py rename to aeon/anomaly_detection/whole_series/_rockad.py diff --git a/aeon/anomaly_detection/whole_series/tests/__init__.py b/aeon/anomaly_detection/whole_series/tests/__init__.py new file mode 100644 index 0000000000..9292e8d9bd --- /dev/null +++ b/aeon/anomaly_detection/whole_series/tests/__init__.py @@ -0,0 +1 @@ +"""Whole series anomaly detection tests.""" diff --git a/aeon/anomaly_detection/tests/test_rockad.py b/aeon/anomaly_detection/whole_series/tests/test_rockad.py similarity index 97% rename from aeon/anomaly_detection/tests/test_rockad.py rename to aeon/anomaly_detection/whole_series/tests/test_rockad.py index d9d133b9a8..7d3694b2c8 100644 --- a/aeon/anomaly_detection/tests/test_rockad.py +++ b/aeon/anomaly_detection/whole_series/tests/test_rockad.py @@ -4,7 +4,7 @@ import pytest from sklearn.utils import check_random_state -from aeon.anomaly_detection import ROCKAD +from aeon.anomaly_detection.whole_series import ROCKAD def test_rockad_univariate(): diff --git a/docs/api_reference/anomaly_detection.rst b/docs/api_reference/anomaly_detection.rst index 082c082fc4..3e22c445b7 100644 --- a/docs/api_reference/anomaly_detection.rst +++ b/docs/api_reference/anomaly_detection.rst @@ -13,29 +13,79 @@ Each detector in this module specifies its supported input data format, output d format, and learning type as an overview table in its documentation. Some detectors support multiple learning types. -Detectors ---------- +.. note:: -.. currentmodule:: aeon.anomaly_detection + Not all algorithm families are currently implemented. The documentation includes + placeholders for planned categories which will be supported in future. + +Distance-based +-------------- + +.. currentmodule:: aeon.anomaly_detection.distance_based .. autosummary:: :toctree: auto_generated/ :template: class.rst CBLOF - COPOD - DWT_MLEAD - IsolationForest KMeansAD LeftSTAMPi LOF MERLIN OneClassSVM - PyODAdapter - ROCKAD STOMP + +Distribution-based +----------------- + +.. currentmodule:: aeon.anomaly_detection.distribution_based + +.. autosummary:: + :toctree: auto_generated/ + :template: class.rst + + COPOD + DWT_MLEAD + +Encoding-based +-------------- + +The algorithms for this family are not implemented yet. + +Forecasting-based +----------------- + +The algorithms for this family are not implemented yet. + +Outlier-Detection +----------------- + +.. currentmodule:: aeon.anomaly_detection.outlier_detection + +.. autosummary:: + :toctree: auto_generated/ + :template: class.rst + + IsolationForest + PyODAdapter STRAY +Reconstruction-based +-------------------- + +The algorithms for this family are not implemented yet. + +Whole-Series +------------ + +.. currentmodule:: aeon.anomaly_detection.whole_series + +.. autosummary:: + :toctree: auto_generated/ + :template: class.rst + + ROCKAD + Base ---- diff --git a/docs/developer_guide/adding_typehints.md b/docs/developer_guide/adding_typehints.md index f3557ddbd9..5f77ce119b 100644 --- a/docs/developer_guide/adding_typehints.md +++ b/docs/developer_guide/adding_typehints.md @@ -25,7 +25,7 @@ When working with modules that use soft dependencies, additional considerations required to ensure that your code can still run even without these dependencies installed. -Here is an example snippet taken from [PyODAdapter](https://www.aeon-toolkit.org/en/stable/api_reference/auto_generated/aeon.anomaly_detection.PyODAdapter.html). +Here is an example snippet taken from [PyODAdapter](https://www.aeon-toolkit.org/en/stable/api_reference/auto_generated/aeon.anomaly_detection.outlier_detection.PyODAdapter.html). It uses the `pyod` library, which is a soft dependency. The `TYPE_CHECKING` constant is used to ensure that the `pyod` library is only imported at the top level while type checking is performed. `from __future__ import annotations` is used to allow forward diff --git a/docs/getting_started.md b/docs/getting_started.md index 36f18583cb..cf74ab9319 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -114,7 +114,7 @@ written the notebook. ```{code-block} python >>> from aeon.datasets import load_airline ->>> from aeon.anomaly_detection import STOMP +>>> from aeon.anomaly_detection.distance_based import STOMP >>> stomp = STOMP(window_size=200) >>> scores = est.fit_predict(X) # Get the anomaly scores ``` diff --git a/examples/anomaly_detection/anomaly_detection.ipynb b/examples/anomaly_detection/anomaly_detection.ipynb index 9f393437e9..7afd00aff8 100644 --- a/examples/anomaly_detection/anomaly_detection.ipynb +++ b/examples/anomaly_detection/anomaly_detection.ipynb @@ -185,7 +185,7 @@ "metadata": {}, "outputs": [], "source": [ - "from aeon.anomaly_detection import STOMP\n", + "from aeon.anomaly_detection.distance_based import STOMP\n", "from aeon.benchmarking.metrics.anomaly_detection import range_roc_auc_score\n", "\n", "detector = STOMP(window_size=200)\n", @@ -211,7 +211,7 @@ "source": [ "from pyod.models.ocsvm import OCSVM\n", "\n", - "from aeon.anomaly_detection import PyODAdapter\n", + "from aeon.anomaly_detection.outlier_detection import PyODAdapter\n", "from aeon.benchmarking.metrics.anomaly_detection import range_roc_auc_score\n", "\n", "detector = PyODAdapter(OCSVM(), window_size=3)\n",