Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/r_cluster_branch' into r_cluster…
Browse files Browse the repository at this point in the history
…_branch

# Conflicts:
#	aeon/clustering/_r_cluster.py
  • Loading branch information
Ramana-Raja committed Nov 27, 2024
2 parents 00e8b89 + 97ba678 commit ae51709
Show file tree
Hide file tree
Showing 153 changed files with 1,255 additions and 1,598 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/periodic_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,31 @@ jobs:
# Save cache with the current date (ENV set in numba_cache action)
key: numba-run-notebook-examples-${{ runner.os }}-3.10-${{ env.CURRENT_DATE }}

test-core-imports:
runs-on: ubuntu-22.04

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install aeon and dependencies
uses: nick-fields/retry@v3
with:
timeout_minutes: 30
max_attempts: 3
command: python -m pip install .

- name: Show dependencies
run: python -m pip list

- name: Run import test
run: python aeon/testing/tests/test_core_imports.py

test-no-soft-deps:
runs-on: ubuntu-22.04

Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/pr_core_dep_import.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: PR module imports

on:
push:
branches:
- main
pull_request:
branches:
- main
paths:
- "aeon/**"
- ".github/workflows/**"
- "pyproject.toml"

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
test-core-imports:
runs-on: ubuntu-22.04

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install aeon and dependencies
uses: nick-fields/retry@v3
with:
timeout_minutes: 30
max_attempts: 3
command: python -m pip install .

- name: Show dependencies
run: python -m pip list

- name: Run import test
run: python aeon/testing/tests/test_core_imports.py
2 changes: 1 addition & 1 deletion .github/workflows/pr_pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
run: python -m pip list

- name: Run tests
run: python -m pytest -n logical -k 'not TestAll'
run: python -m pytest -n logical

pytest:
runs-on: ${{ matrix.os }}
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ python:
- docs

build:
os: ubuntu-20.04
os: ubuntu-22.04
tools:
python: "3.10"

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ The following modules are still considered experimental, and the [deprecation po
does not apply:

- `anomaly_detection`
- `forecasting`
- `segmentation`
- `similarity_search`
- `visualisation`
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

__all__ = ["BaseRIST"]

from aeon.base.estimators.hybrid.base_rist import BaseRIST
from aeon.base._estimators.hybrid.base_rist import BaseRIST
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

__all__ = ["BaseIntervalForest"]

from aeon.base.estimators.interval_based.base_interval_forest import BaseIntervalForest
from aeon.base._estimators.interval_based.base_interval_forest import BaseIntervalForest
2 changes: 1 addition & 1 deletion aeon/base/tests/test_base_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
UNEQUAL_LENGTH_MULTIVARIATE_CLASSIFICATION,
UNEQUAL_LENGTH_UNIVARIATE_CLASSIFICATION,
)
from aeon.utils import COLLECTIONS_DATA_TYPES
from aeon.utils.data_types import COLLECTIONS_DATA_TYPES
from aeon.utils.validation import get_type


Expand Down
2 changes: 1 addition & 1 deletion aeon/classification/compose/_channel_ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import numpy as np
from sklearn.utils import check_random_state

from aeon.base.estimators.compose.collection_channel_ensemble import (
from aeon.base._estimators.compose.collection_channel_ensemble import (
BaseCollectionChannelEnsemble,
)
from aeon.classification.base import BaseClassifier
Expand Down
2 changes: 1 addition & 1 deletion aeon/classification/compose/_ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import numpy as np
from sklearn.utils import check_random_state

from aeon.base.estimators.compose.collection_ensemble import BaseCollectionEnsemble
from aeon.base._estimators.compose.collection_ensemble import BaseCollectionEnsemble
from aeon.classification.base import BaseClassifier
from aeon.classification.sklearn._wrapper import SklearnClassifierWrapper
from aeon.utils.sklearn import is_sklearn_classifier
Expand Down
2 changes: 1 addition & 1 deletion aeon/classification/compose/_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
__all__ = ["ClassifierPipeline"]


from aeon.base.estimators.compose.collection_pipeline import BaseCollectionPipeline
from aeon.base._estimators.compose.collection_pipeline import BaseCollectionPipeline
from aeon.classification.base import BaseClassifier


Expand Down
6 changes: 3 additions & 3 deletions aeon/classification/distance_based/_proximity_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def _get_best_splitter(self, X, y):
dist = distance(
X[j],
splitter[0][labels[k]],
metric=measure,
measure=measure,
**splitter[1][measure],
)
if dist < min_dist:
Expand Down Expand Up @@ -320,7 +320,7 @@ def _build_tree(self, X, y, depth, node_id, parent_target_value=None):
dist = distance(
X[i],
splitter[0][labels[j]],
metric=measure,
measure=measure,
**splitter[1][measure],
)
if dist < min_dist:
Expand Down Expand Up @@ -404,7 +404,7 @@ def _classify(self, treenode, x):
dist = distance(
x,
treenode.splitter[0][branches[i]],
metric=measure,
measure=measure,
**treenode.splitter[1][measure],
)
if dist < min_dist:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def _fit(self, X, y):
y : array-like, shape = (n_cases)
The class labels.
"""
self.metric_ = get_distance_function(metric=self.distance)
self.metric_ = get_distance_function(measure=self.distance)
self.X_ = X
self.classes_, self.y_ = np.unique(y, return_inverse=True)
return self
Expand Down
2 changes: 1 addition & 1 deletion aeon/classification/hybrid/_rist.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from sklearn.ensemble import ExtraTreesClassifier
from sklearn.preprocessing import FunctionTransformer

from aeon.base.estimators.hybrid import BaseRIST
from aeon.base._estimators.hybrid import BaseRIST
from aeon.classification import BaseClassifier
from aeon.utils.numba.general import first_order_differences_3d

Expand Down
2 changes: 1 addition & 1 deletion aeon/classification/interval_based/_cif.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import numpy as np

from aeon.base.estimators.interval_based import BaseIntervalForest
from aeon.base._estimators.interval_based import BaseIntervalForest
from aeon.classification import BaseClassifier
from aeon.classification.sklearn import ContinuousIntervalTree
from aeon.transformations.collection.feature_based import Catch22
Expand Down
2 changes: 1 addition & 1 deletion aeon/classification/interval_based/_drcif.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import numpy as np
from sklearn.preprocessing import FunctionTransformer

from aeon.base.estimators.interval_based import BaseIntervalForest
from aeon.base._estimators.interval_based import BaseIntervalForest
from aeon.classification.base import BaseClassifier
from aeon.classification.sklearn._continuous_interval_tree import ContinuousIntervalTree
from aeon.transformations.collection import PeriodogramTransformer
Expand Down
2 changes: 1 addition & 1 deletion aeon/classification/interval_based/_interval_forest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import numpy as np

from aeon.base.estimators.interval_based.base_interval_forest import BaseIntervalForest
from aeon.base._estimators.interval_based.base_interval_forest import BaseIntervalForest
from aeon.classification.base import BaseClassifier


Expand Down
2 changes: 1 addition & 1 deletion aeon/classification/interval_based/_rise.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import numpy as np

from aeon.base.estimators.interval_based.base_interval_forest import BaseIntervalForest
from aeon.base._estimators.interval_based.base_interval_forest import BaseIntervalForest
from aeon.classification import BaseClassifier
from aeon.classification.sklearn import ContinuousIntervalTree
from aeon.transformations.collection import (
Expand Down
2 changes: 1 addition & 1 deletion aeon/classification/interval_based/_stsf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import numpy as np
from sklearn.preprocessing import FunctionTransformer

from aeon.base.estimators.interval_based.base_interval_forest import BaseIntervalForest
from aeon.base._estimators.interval_based.base_interval_forest import BaseIntervalForest
from aeon.classification.base import BaseClassifier
from aeon.transformations.collection import PeriodogramTransformer
from aeon.utils.numba.general import first_order_differences_3d
Expand Down
2 changes: 1 addition & 1 deletion aeon/classification/interval_based/_tsf.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import numpy as np

from aeon.base.estimators.interval_based.base_interval_forest import BaseIntervalForest
from aeon.base._estimators.interval_based.base_interval_forest import BaseIntervalForest
from aeon.classification import BaseClassifier
from aeon.classification.sklearn import ContinuousIntervalTree

Expand Down
2 changes: 2 additions & 0 deletions aeon/classification/sklearn/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
__all__ = [
"RotationForestClassifier",
"ContinuousIntervalTree",
"SklearnClassifierWrapper",
]

from aeon.classification.sklearn._continuous_interval_tree import ContinuousIntervalTree
from aeon.classification.sklearn._rotation_forest_classifier import (
RotationForestClassifier,
)
from aeon.classification.sklearn._wrapper import SklearnClassifierWrapper
4 changes: 2 additions & 2 deletions aeon/classification/sklearn/_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class SklearnClassifierWrapper(BaseClassifier):
"""

_tags = {
"X_inner_type": ["np-list", "numpy3D"],
"X_inner_type": "numpy2D",
}

def __init__(self, classifier, random_state=None):
Expand All @@ -35,7 +35,7 @@ def __init__(self, classifier, random_state=None):

super().__init__()

def _fit(self, X, y=None):
def _fit(self, X, y):
self.classifier_ = _clone_estimator(self.classifier, self.random_state)
self.classifier_.fit(X, y)
return self
Expand Down
2 changes: 1 addition & 1 deletion aeon/classification/tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
EQUAL_LENGTH_UNIVARIATE_CLASSIFICATION,
UNEQUAL_LENGTH_UNIVARIATE_CLASSIFICATION,
)
from aeon.utils import COLLECTIONS_DATA_TYPES
from aeon.utils.data_types import COLLECTIONS_DATA_TYPES

__maintainer__ = []

Expand Down
6 changes: 3 additions & 3 deletions aeon/clustering/_clara.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class TimeSeriesCLARA(BaseClusterer):
If a np.ndarray provided it must be of shape (n_clusters,) and contain
the indexes of the time series to use as centroids.
distance : str or Callable, default='msm'
Distance metric to compute similarity between time series. A list of valid
Distance measure to compute similarity between time series. A list of valid
strings for metrics can be found in the documentation for
:func:`aeon.distances.get_distance_function`. If a callable is passed it must be
a function that takes two 2d numpy arrays as input and returns a float.
Expand Down Expand Up @@ -73,7 +73,7 @@ class TimeSeriesCLARA(BaseClusterer):
If `None`, the random number generator is the `RandomState` instance used
by `np.random`.
distance_params : dict, default=None
Dictionary containing kwargs for the distance metric being used.
Dictionary containing kwargs for the distance measure being used.
Attributes
----------
Expand Down Expand Up @@ -189,7 +189,7 @@ def _fit(self, X: np.ndarray, y=None):
curr_centers = pam.cluster_centers_
if isinstance(pam.distance, str):
pairwise_matrix = pairwise_distance(
X, curr_centers, metric=self.distance, **pam._distance_params
X, curr_centers, measure=self.distance, **pam._distance_params
)
else:
pairwise_matrix = pairwise_distance(
Expand Down
6 changes: 3 additions & 3 deletions aeon/clustering/_clarans.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ class TimeSeriesCLARANS(TimeSeriesKMedoids):
If a np.ndarray provided it must be of shape (n_clusters,) and contain
the indexes of the time series to use as centroids.
distance : str or Callable, default='msm'
Distance metric to compute similarity between time series. A list of valid
strings for metrics can be found in the documentation for
Distance measure to compute similarity between time series. A list of valid
strings for measures can be found in the documentation for
:func:`aeon.distances.get_distance_function`. If a callable is passed it must be
a function that takes two 2d numpy arrays as input and returns a float.
max_neighbours : int, default=None,
Expand All @@ -62,7 +62,7 @@ class TimeSeriesCLARANS(TimeSeriesKMedoids):
random_state : int or np.random.RandomState instance or None, default=None
Determines random number generation for centroid initialization.
distance_params : dict, default=None
Dictionary containing kwargs for the distance metric being used.
Dictionary containing kwargs for the distance measure being used.
Attributes
----------
Expand Down
8 changes: 4 additions & 4 deletions aeon/clustering/_elastic_som.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ class ElasticSOM(BaseClusterer):
n_clusters : int, default=8
The number of clusters to form as well as the number of centroids to generate.
distance : str or Callable, default='dtw'
Distance metric to compute similarity between time series. A list of valid
strings for metrics can be found in the documentation for
Distance measure to compute similarity between time series. A list of valid
strings for measures can be found in the documentation for
:func:`aeon.distances.get_distance_function`. If a callable is passed it must be
a function that takes two 2d numpy arrays as input and returns a float.
init : str or np.ndarray, default='random'
Expand Down Expand Up @@ -224,7 +224,7 @@ def _find_bmu(self, x, weights):
pairwise_matrix = pairwise_distance(
x,
weights,
metric=self.distance,
measure=self.distance,
**self._distance_params,
)
return pairwise_matrix.argmin(axis=1)
Expand Down Expand Up @@ -366,7 +366,7 @@ def _kmeans_plus_plus_center_initializer(self, X: np.ndarray):

for _ in range(1, self.n_clusters):
pw_dist = pairwise_distance(
X, X[indexes], metric=self.distance, **self._distance_params
X, X[indexes], measure=self.distance, **self._distance_params
)
min_distances = pw_dist.min(axis=1)
probabilities = min_distances / min_distances.sum()
Expand Down
Loading

0 comments on commit ae51709

Please sign in to comment.