Skip to content
6 changes: 4 additions & 2 deletions aeon/segmentation/_binseg.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ class BinSegmenter(BaseSegmenter):
"python_dependencies": "ruptures",
}

def __init__(self, n_cps=1, model="l2", min_size=2, jump=5):
def __init__(
self, n_cps: int = 1, model: str = "l2", min_size: int = 2, jump: int = 5
):
self.n_cps = n_cps
self.model = model
self.min_size = min_size
Expand Down Expand Up @@ -122,7 +124,7 @@ def _get_interval_series(self, X, found_cps):
return pd.IntervalIndex.from_arrays(start, end)

@classmethod
def _get_test_params(cls, parameter_set="default"):
def _get_test_params(cls, parameter_set: str = "default"):
"""Return testing parameter settings for the estimator.

Parameters
Expand Down
25 changes: 17 additions & 8 deletions aeon/segmentation/_clasp.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

__maintainer__ = []
__all__ = ["ClaSPSegmenter", "find_dominant_window_sizes"]

from queue import PriorityQueue

import numpy as np
Expand All @@ -15,7 +14,7 @@
from aeon.utils.validation import check_n_jobs


def find_dominant_window_sizes(X, offset=0.05):
def find_dominant_window_sizes(X, offset: float = 0.05):
"""Determine the Window-Size using dominant FFT-frequencies.

Parameters
Expand Down Expand Up @@ -55,7 +54,9 @@ def find_dominant_window_sizes(X, offset=0.05):
)


def _is_trivial_match(candidate, change_points, n_timepoints, exclusion_radius=0.05):
def _is_trivial_match(
candidate: int, change_points, n_timepoints: int, exclusion_radius: float = 0.05
):
"""Check if a candidate change point is in close proximity to other change points.

Parameters
Expand Down Expand Up @@ -87,7 +88,9 @@ def _is_trivial_match(candidate, change_points, n_timepoints, exclusion_radius=0
return False


def _segmentation(X, clasp, n_change_points=None, exclusion_radius=0.05):
def _segmentation(
X, clasp, n_change_points: int | None = None, exclusion_radius: float = 0.05
):
"""Segments the time series by extracting change points.

Parameters
Expand Down Expand Up @@ -182,7 +185,7 @@ class ClaSPSegmenter(BaseSegmenter):
Size of window for sliding, based on the period length of the data.
n_cps : int, default = 1
The number of change points to search.
exclusion_radius : int
exclusion_radius : float
Exclusion Radius for change points to be non-trivial matches.
n_jobs : int, default=1
Number of jobs to be used.
Expand All @@ -209,7 +212,13 @@ class ClaSPSegmenter(BaseSegmenter):

_tags = {"capability:multithreading": True, "fit_is_empty": True}

def __init__(self, period_length=10, n_cps=1, exclusion_radius=0.05, n_jobs=1):
def __init__(
self,
period_length: int = 10,
n_cps: int = 1,
exclusion_radius: float = 0.05,
n_jobs: int = 1,
):
self.period_length = int(period_length)
self.n_cps = n_cps
self.exclusion_radius = exclusion_radius
Expand Down Expand Up @@ -289,7 +298,7 @@ def _get_interval_series(self, X, found_cps):
Parameters
----------
X : array-like, shape = [n]
Univariate time-series data to be segmented.
Univariate time-series data to be segmented.
found_cps : array-like, shape = [n_cps] The found change points found

Returns
Expand All @@ -304,7 +313,7 @@ def _get_interval_series(self, X, found_cps):
return pd.IntervalIndex.from_arrays(start, end)

@classmethod
def _get_test_params(cls, parameter_set="default"):
def _get_test_params(cls, parameter_set: str = "default"):
"""Return testing parameter settings for the estimator.

Parameters
Expand Down
2 changes: 1 addition & 1 deletion aeon/segmentation/_eagglo.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class EAggloSegmenter(BaseSegmenter):
def __init__(
self,
member=None,
alpha=1.0,
alpha: float = 1.0,
penalty=None,
):
self.member = member
Expand Down
6 changes: 4 additions & 2 deletions aeon/segmentation/_fluss.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ class FLUSSSegmenter(BaseSegmenter):
"python_dependencies": "stumpy",
}

def __init__(self, period_length=10, n_regimes=2, exclusion_factor=5):
def __init__(
self, period_length: int = 10, n_regimes: int = 2, exclusion_factor: int = 5
):
self.period_length = int(period_length)
self.n_regimes = n_regimes
self.exclusion_factor = exclusion_factor
Expand Down Expand Up @@ -137,7 +139,7 @@ def _get_interval_series(self, X, found_cps):
return pd.IntervalIndex.from_arrays(start, end)

@classmethod
def _get_test_params(cls, parameter_set="default"):
def _get_test_params(cls, parameter_set: str = "default"):
"""Return testing parameter settings for the estimator.

Parameters
Expand Down
20 changes: 18 additions & 2 deletions aeon/segmentation/_random.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,23 @@
class RandomSegmenter(BaseSegmenter):
"""Random Segmenter.

Randomly segments a time series.
Randomly segments a time series into a specified number of segments
at random cut points.

Parameters
----------
n_segments : int, default=2
Number of segments to split the time series into (must be >= 2).
random_state : int, RandomState instance or None, default=None
Random seed for reproducibility.

Examples
--------
>>> from aeon.segmentation import RandomSegmenter
>>> segmenter = RandomSegmenter(n_segments=3)
>>> from aeon.testing.data_generation import make_example_1d_numpy
>>> X = make_example_1d_numpy(n_timepoints=100, random_state=0)
>>> found_cps = segmenter.fit_predict(X)
"""

_tags = {
Expand All @@ -20,7 +36,7 @@ class RandomSegmenter(BaseSegmenter):
"returns_dense": True,
}

def __init__(self, random_state=None, n_segments=2):
def __init__(self, random_state=None, n_segments: int = 2):
self.random_state = random_state
self.breakpoints_ = []
super().__init__(axis=1, n_segments=n_segments)
Expand Down