Skip to content
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

[MNT] Clustering module 1.0 deprecations #2306

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 0 additions & 2 deletions aeon/clustering/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"TimeSeriesCLARANS",
"TimeSeriesKMeans",
"TimeSeriesKShape",
"TimeSeriesKShapes",
"TimeSeriesKernelKMeans",
"ElasticSOM",
"KSpectralCentroid",
Expand All @@ -21,7 +20,6 @@
from aeon.clustering._k_medoids import TimeSeriesKMedoids
from aeon.clustering._k_sc import KSpectralCentroid
from aeon.clustering._k_shape import TimeSeriesKShape
from aeon.clustering._k_shapes import TimeSeriesKShapes
from aeon.clustering._kernel_k_means import TimeSeriesKernelKMeans
from aeon.clustering.base import BaseClusterer
from aeon.clustering.dummy import DummyClusterer
12 changes: 0 additions & 12 deletions aeon/clustering/_k_means.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,20 +169,8 @@ def __init__(
averaging_method: Union[str, Callable[[np.ndarray], np.ndarray]] = "ba",
distance_params: Optional[dict] = None,
average_params: Optional[dict] = None,
init_algorithm: Optional[Union[str, np.ndarray]] = None,
):
self.init = init
self.init_algorithm = init_algorithm
if init_algorithm is not None:
import warnings

warnings.warn(
"The 'init_algorithm' parameter is deprecated and will be "
"removed in a future. Version Use 'init' instead.",
DeprecationWarning,
stacklevel=2,
)
self.init = self.init_algorithm
self.distance = distance
self.n_init = n_init
self.max_iter = max_iter
Expand Down
185 changes: 0 additions & 185 deletions aeon/clustering/_k_shapes.py

This file was deleted.

3 changes: 0 additions & 3 deletions aeon/clustering/deep_learning/_ae_bgru.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ class AEBiGRUClusterer(BaseDeepClusterer):
----------
n_clusters : int, default=None
Number of clusters for the deep learnign model.
clustering_algorithm : str, default="deprecated"
Use 'estimator' parameter instead.
clustering_params : dict, default=None
Use 'estimator' parameter instead.
estimator : aeon clusterer, default=None
Expand Down Expand Up @@ -100,7 +98,6 @@ class AEBiGRUClusterer(BaseDeepClusterer):
def __init__(
self,
n_clusters=None,
clustering_algorithm="deprecated",
estimator=None,
clustering_params=None,
latent_space_dim=128,
Expand Down
4 changes: 0 additions & 4 deletions aeon/clustering/deep_learning/_ae_fcn.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ class AEFCNClusterer(BaseDeepClusterer):
An aeon estimator to be built using the transformed data.
Defaults to aeon TimeSeriesKMeans() with euclidean distance
and mean averaging method and n_clusters set to 2.
clustering_algorithm : str, default="deprecated"
Please use 'estimator' parameter.
clustering_params : dict, default=None
Please use 'estimator' parameter.
latent_space_dim : int, default=128
Expand Down Expand Up @@ -124,7 +122,6 @@ def __init__(
self,
n_clusters=None,
estimator=None,
clustering_algorithm="deprecated",
clustering_params=None,
latent_space_dim=128,
temporal_latent_space=False,
Expand Down Expand Up @@ -177,7 +174,6 @@ def __init__(
super().__init__(
estimator=estimator,
n_clusters=n_clusters,
clustering_algorithm=clustering_algorithm,
clustering_params=clustering_params,
batch_size=batch_size,
last_file_name=last_file_name,
Expand Down
4 changes: 0 additions & 4 deletions aeon/clustering/deep_learning/_ae_resnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ class AEResNetClusterer(BaseDeepClusterer):
An aeon estimator to be built using the transformed data.
Defaults to aeon TimeSeriesKMeans() with euclidean distance
and mean averaging method and n_clusters set to 2.
clustering_algorithm : str, default="deprecated"
Please use 'estimator' parameter.
clustering_params : dict, default=None
Please use 'estimator' parameter.
latent_space_dim : int, default=128
Expand Down Expand Up @@ -134,7 +132,6 @@ def __init__(
n_clusters=None,
estimator=None,
n_residual_blocks=3,
clustering_algorithm="deprecated",
clustering_params=None,
n_conv_per_residual_block=3,
n_filters=None,
Expand Down Expand Up @@ -188,7 +185,6 @@ def __init__(
super().__init__(
estimator=estimator,
n_clusters=n_clusters,
clustering_algorithm=clustering_algorithm,
clustering_params=clustering_params,
batch_size=batch_size,
last_file_name=last_file_name,
Expand Down
22 changes: 0 additions & 22 deletions aeon/clustering/deep_learning/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ class BaseDeepClusterer(BaseClusterer):
An aeon estimator to be built using the transformed data.
Defaults to aeon TimeSeriesKMeans() with euclidean distance
and mean averaging method and n_clusters set to 2.
clustering_algorithm : str, default="deprecated"
Please use 'estimator' parameter.
clustering_params : dict, default=None
Please use 'estimator' parameter.
batch_size : int, default = 40
Expand All @@ -44,14 +42,12 @@ def __init__(
self,
n_clusters=None,
estimator=None,
clustering_algorithm="deprecated",
clustering_params=None,
batch_size=32,
last_file_name="last_file",
):
self.estimator = estimator
self.n_clusters = n_clusters
self.clustering_algorithm = clustering_algorithm
self.clustering_params = clustering_params
self.batch_size = batch_size
self.last_file_name = last_file_name
Expand Down Expand Up @@ -109,8 +105,6 @@ def _fit_clustering(self, X):
X : np.ndarray, shape=(n_cases, n_timepoints, n_channels)
The input time series.
"""
import warnings

self._estimator = (
TimeSeriesKMeans(
n_clusters=2, distance="euclidean", averaging_method="mean"
Expand All @@ -120,22 +114,6 @@ def _fit_clustering(self, X):
)

# to be removed in 1.0.0
if (
self.clustering_algorithm != "deprecated"
or self.clustering_params is not None
or self.n_clusters is not None
):
warnings.warn(
"The 'n_clusters' 'clustering_algorithm' and "
"'clustering_params' parameters "
"will be removed in v1.0.0. "
Copy link
Member

Choose a reason for hiding this comment

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

n_clusters and clustering_params are also to be deprecated, all replaced by estimator now

"Their usage will not have an effect, "
"please use the new 'estimator' parameter to directly "
"give an aeon clusterer as input.",
FutureWarning,
stacklevel=2,
)

latent_space = self.model_.layers[1].predict(X)
self._estimator.fit(X=latent_space)

Expand Down
2 changes: 1 addition & 1 deletion examples/networks/deep_learning.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@
"aefcn = AEFCNClusterer(\n",
" n_clusters=2,\n",
" temporal_latent_space=False,\n",
" clustering_algorithm=\"kmeans\",\n",
" estimator=\"kmeans\",\n",
" n_epochs=10,\n",
")\n",
"\n",
Expand Down
Loading