diff --git a/aeon/base/_compose.py b/aeon/base/_compose.py index 0995e85de6..8661245806 100644 --- a/aeon/base/_compose.py +++ b/aeon/base/_compose.py @@ -12,8 +12,10 @@ class ComposableEstimatorMixin(ABC): """Handles parameter management for estimators composed of named estimators. - Parts (i.e. get_params and set_params) adapted or copied from the scikit-learn + Parts (i.e. get_params and set_params) adapted from the scikit-learn 1.5.0 ``_BaseComposition`` class in utils/metaestimators.py. + https://github.com/scikit-learn/scikit-learn/ + Copyright (c) 2007-2024 The scikit-learn developers, BSD-3 """ # Attribute name containing an iterable of processed (str, estimator) tuples diff --git a/aeon/classification/dictionary_based/_redcomets.py b/aeon/classification/dictionary_based/_redcomets.py index 601f573bdf..c593c8922f 100644 --- a/aeon/classification/dictionary_based/_redcomets.py +++ b/aeon/classification/dictionary_based/_redcomets.py @@ -66,7 +66,8 @@ class REDCOMETS(BaseClassifier): Notes ----- - Adapted from the implementation at https://github.com/zy18811/RED-CoMETS + Adapted from the implementation at https://github.com/zy18811/RED-CoMETS by + the code owner. References ---------- diff --git a/aeon/clustering/_kernel_k_means.py b/aeon/clustering/_kernel_k_means.py index 98cac93127..062b06ebc8 100644 --- a/aeon/clustering/_kernel_k_means.py +++ b/aeon/clustering/_kernel_k_means.py @@ -64,7 +64,7 @@ def _kdtw_lk(x, y, local_kernel): return cost_matrix[x_timepoints - 1, y_timepoints - 1] -def kdtw(x, y, sigma=1.0, epsilon=1e-3): +def _kdtw(x, y, sigma=1.0, epsilon=1e-3): """ Callable kernel function for KernelKMeans. @@ -81,6 +81,12 @@ def kdtw(x, y, sigma=1.0, epsilon=1e-3): A small constant added for numerical stability to avoid zero values in the local kernel matrix. + Notes + ----- + Inspired by the original implementation + https://github.com/pfmarteau/KDTW/tree/master + Copyright (c) 2020 Pierre-François Marteau, MIT License + Returns ------- similarity : float @@ -92,35 +98,6 @@ def kdtw(x, y, sigma=1.0, epsilon=1e-3): return _kdtw_lk(x, y, local_kernel) -def factory_kdtw_kernel(channels: int): - """ - Return a kdtw kernel callable function that flattened samples to (T, channels). - - Parameters - ---------- - channels: int - Number of channels per timepoint. - - Returns - ------- - kdtw_kernel : callable - A callable kernel function that computes the KDTW similarity between two - time series samples. The function signature is the same as the kdtw - function. - """ - - def kdtw_kernel(x, y, sigma=1.0, epsilon=1e-3): - if x.ndim == 1: - T = x.size // channels - x = x.reshape(T, channels) - if y.ndim == 1: - T = y.size // channels - y = y.reshape(T, channels) - return kdtw(x, y, sigma=sigma, epsilon=epsilon) - - return kdtw_kernel - - class TimeSeriesKernelKMeans(BaseClusterer): """Kernel K Means [1]_: wrapper of the ``tslearn`` implementation. @@ -255,7 +232,18 @@ def _fit(self, X, y=None): verbose = 1 if self.kernel == "kdtw": - self.kernel = factory_kdtw_kernel(channels=X.shape[1]) + n_channels = X.shape[1] + + def kdtw_kernel(x, y, sigma=1.0, epsilon=1e-3): + if x.ndim == 1: + T = x.size // n_channels + x = x.reshape(T, n_channels) + if y.ndim == 1: + T = y.size // n_channels + y = y.reshape(T, n_channels) + return _kdtw(x, y, sigma=sigma, epsilon=epsilon) + + self.kernel = kdtw_kernel self._tslearn_kernel_k_means = TsLearnKernelKMeans( n_clusters=self.n_clusters, diff --git a/aeon/distances/elastic/_bounding_matrix.py b/aeon/distances/elastic/_bounding_matrix.py index 509dff6edf..3b4d76b4a2 100644 --- a/aeon/distances/elastic/_bounding_matrix.py +++ b/aeon/distances/elastic/_bounding_matrix.py @@ -63,8 +63,14 @@ def create_bounding_matrix( def _itakura_parallelogram(x_size: int, y_size: int, max_slope_percent: float): """Itakura parallelogram bounding matrix. - This code was adapted from pyts. This link to the original code: + This code was adapted from the tslearn and pyts functions. + + pyts code: https://pyts.readthedocs.io/en/latest/_modules/pyts/metrics/dtw.html#itakura_parallelogram + Copyright (c) 2018, Johann Faouzi and pyts contributors, BSD-3 + tslearn code (line 974): + https://github.com/tslearn-team/tslearn/blob/main/tslearn/metrics/dtw_variants.py + Copyright (c) 2017, Romain Tavenard, BSD-2 """ one_percent = min(x_size, y_size) / 100 max_slope = math.floor((max_slope_percent * one_percent) * 100) diff --git a/aeon/regression/deep_learning/_lite_time.py b/aeon/regression/deep_learning/_lite_time.py index ffd050f176..9af8bbaf4e 100644 --- a/aeon/regression/deep_learning/_lite_time.py +++ b/aeon/regression/deep_learning/_lite_time.py @@ -105,6 +105,7 @@ class LITETimeRegressor(BaseRegressor): ----- Adapted from the implementation from Ismail-Fawaz et. al https://github.com/MSD-IRIMAS/LITE + by the code owner. References ---------- @@ -388,6 +389,7 @@ class IndividualLITERegressor(BaseDeepRegressor): ----- Adapted from the implementation from Ismail-Fawaz et. al https://github.com/MSD-IRIMAS/LITE + by the code owner. References ---------- diff --git a/aeon/segmentation/_ggs.py b/aeon/segmentation/_ggs.py index d8bdd21d71..0a1bb615af 100644 --- a/aeon/segmentation/_ggs.py +++ b/aeon/segmentation/_ggs.py @@ -23,6 +23,7 @@ Based on the work from [1]_. - source code adapted based on: https://github.com/cvxgrp/GGS + Copyright (c) 2018, Stanford University Convex Optimization Group, BSD-2 - paper available at: https://stanford.edu/~boyd/papers/pdf/ggs.pdf References diff --git a/aeon/transformations/collection/convolution_based/_minirocket.py b/aeon/transformations/collection/convolution_based/_minirocket.py index 603c381fb7..cdc62d42b0 100644 --- a/aeon/transformations/collection/convolution_based/_minirocket.py +++ b/aeon/transformations/collection/convolution_based/_minirocket.py @@ -55,7 +55,7 @@ class MiniRocket(BaseCollectionTransformer): Notes ----- Directly adapted from the original implementation - https://github.com/angus924/minirocket. + https://github.com/angus924/minirocket with owner permission. Examples -------- diff --git a/aeon/transformations/series/_bkfilter.py b/aeon/transformations/series/_bkfilter.py index 62440d1a2c..65f684b2bc 100644 --- a/aeon/transformations/series/_bkfilter.py +++ b/aeon/transformations/series/_bkfilter.py @@ -34,8 +34,9 @@ class BKFilter(BaseSeriesTransformer): Notes ----- - Adapted from statsmodels implementation + Adapted from statsmodels 0.14.4 implementation https://github.com/statsmodels/statsmodels/blob/main/statsmodels/tsa/filters/bk_filter.py + Copyright (c) 2009-2018 statsmodels Developers, BSD-3 References ---------- diff --git a/aeon/utils/show_versions.py b/aeon/utils/show_versions.py index 00cfe19a0e..1906415f2e 100644 --- a/aeon/utils/show_versions.py +++ b/aeon/utils/show_versions.py @@ -1,7 +1,4 @@ -"""Utility methods to print system info for debugging. - -Adapted from the sklearn show_versions function. -""" +"""Utility methods to print system info for debugging.""" __maintainer__ = ["MatthewMiddlehurst"] __all__ = ["show_versions"] @@ -37,6 +34,12 @@ def show_versions(as_str: bool = False) -> Union[str, None]: str or None The output string if `as_str` is True, otherwise None. + Notes + ----- + Adapted from the scikit-learn 1.5.0 show_versions function. + https://github.com/scikit-learn/scikit-learn/ + Copyright (c) 2007-2024 The scikit-learn developers, BSD-3 + Examples -------- >>> from aeon.utils import show_versions diff --git a/aeon/visualisation/results/_critical_difference.py b/aeon/visualisation/results/_critical_difference.py index df50cbdc45..7d7cb78aca 100644 --- a/aeon/visualisation/results/_critical_difference.py +++ b/aeon/visualisation/results/_critical_difference.py @@ -88,8 +88,8 @@ def plot_critical_difference( overall performance in general, and such comparisons should be seen as exploratory analysis rather than designed experiments to test an a priori hypothesis. - Parts of the code are adapted from here: - https://github.com/hfawaz/cd-diagram + Parts of the code are adapted from https://github.com/hfawaz/cd-diagram + with permission from the owner. Parameters ---------- diff --git a/docs/_sphinxext/sphinx_remove_toctrees.py b/docs/_sphinxext/sphinx_remove_toctrees.py index c27aee2d8e..25b00d251e 100644 --- a/docs/_sphinxext/sphinx_remove_toctrees.py +++ b/docs/_sphinxext/sphinx_remove_toctrees.py @@ -9,6 +9,7 @@ https://github.com/mne-tools/mne-lsl https://github.com/mne-tools/mne-lsl/blob/main/doc/_sphinxext/sphinx_remove_toctrees.py +Copyright © 2023-2024, authors of MNE-LSL, BSD-3 """ from pathlib import Path