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

[ENH] Remove test exclusions #2409

Open
wants to merge 6 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
12 changes: 5 additions & 7 deletions aeon/segmentation/_binseg.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ class BinSegmenter(BaseSegmenter):

def __init__(self, n_cps=1, model="l2", min_size=2, jump=5):
self.n_cps = n_cps
self.model = model
self.min_size = min_size
self.jump = jump
self.model = model
super().__init__(n_segments=n_cps + 1, axis=1)

def _predict(self, X: np.ndarray):
Expand All @@ -79,8 +79,8 @@ def _predict(self, X: np.ndarray):
List of change points found in X.
"""
X = X.squeeze()
self.found_cps = self._run_binseg(X)
return self.found_cps
found_cps = self._run_binseg(X)
return found_cps

def get_fitted_params(self):
"""Get fitted parameters.
Expand All @@ -97,11 +97,9 @@ def _run_binseg(self, X):
binseg = rpt.Binseg(
model=self.model, min_size=self.min_size, jump=self.jump
).fit(X)
self.found_cps = np.array(
binseg.predict(n_bkps=self.n_cps)[:-1], dtype=np.int64
)
found_cps = np.array(binseg.predict(n_bkps=self.n_cps)[:-1], dtype=np.int64)

return self.found_cps
return found_cps

def _get_interval_series(self, X, found_cps):
"""Get the segmentation results based on the found change points.
Expand Down
4 changes: 2 additions & 2 deletions aeon/segmentation/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def fit(self, X, y=None, axis=1):
self.reset()
if axis is None: # If none given, assume it is correct.
axis = self.axis
X = self._preprocess_series(X, axis, True)
X = self._preprocess_series(X, axis, False)
if y is not None:
y = self._check_y(y)
self._fit(X=X, y=y)
Expand Down Expand Up @@ -150,7 +150,7 @@ def predict(self, X, axis=1):
self._check_is_fitted()
if axis is None:
axis = self.axis
X = self._preprocess_series(X, axis, self.get_tag("fit_is_empty"))
X = self._preprocess_series(X, axis, False)
return self._predict(X)

def fit_predict(self, X, y=None, axis=1):
Expand Down
12 changes: 0 additions & 12 deletions aeon/testing/testing_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,6 @@
"GreedyGaussianSegmenter": ["check_non_state_changing_method"],
"ClaSPSegmenter": ["check_non_state_changing_method"],
"HMMSegmenter": ["check_non_state_changing_method"],
"BinSegmenter": ["check_non_state_changing_method"],
"QUANTTransformer": ["check_non_state_changing_method"],
"MatrixProfileSeriesTransformer": ["check_non_state_changing_method"],
"PLASeriesTransformer": ["check_non_state_changing_method"],
"AutoCorrelationSeriesTransformer": ["check_non_state_changing_method"],
"SIVSeriesTransformer": ["check_non_state_changing_method"],
"RocketClassifier": ["check_non_state_changing_method"],
"MiniRocketClassifier": ["check_non_state_changing_method"],
"MultiRocketClassifier": ["check_non_state_changing_method"],
"RocketRegressor": ["check_non_state_changing_method"],
"MiniRocketRegressor": ["check_non_state_changing_method"],
"MultiRocketRegressor": ["check_non_state_changing_method"],
"RSTSF": ["check_non_state_changing_method"],
# Keeps length during predict to avoid recomputing means and std of data in fit
# if the next predict calls uses the same query length parameter.
Expand Down
12 changes: 6 additions & 6 deletions aeon/transformations/series/_acf.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,18 @@ def _transform(self, X, y=None):
"""
# statsmodels acf function uses min(10 * np.log10(nobs), nobs - 1)
if self.n_lags is None:
self._n_lags = int(max(1, X.shape[1] / 4))
n_lags = int(max(1, X.shape[1] / 4))
else:
self._n_lags = int(self.n_lags)
if self._n_lags < 1:
self._n_lags = 1
if X.shape[1] - self._n_lags < 3:
n_lags = int(self.n_lags)
if n_lags < 1:
n_lags = 1
if X.shape[1] - n_lags < 3:
raise ValueError(
f"The number of lags is too large for the length of the "
f"series, autocorrelation would be calculated with just"
f"{X.shape[1]-self._n_lags} observations."
)
return self._acf(X, max_lag=self._n_lags)
return self._acf(X, max_lag=n_lags)

@staticmethod
@njit(cache=True, fastmath=True)
Expand Down
4 changes: 2 additions & 2 deletions aeon/transformations/series/_matrix_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,5 @@ def _transform(self, X, y=None):

X = X.squeeze()

self.matrix_profile_ = stumpy.stump(X, self.window_length)
return self.matrix_profile_[:, 0].astype("float")
matrix_profile = stumpy.stump(X, self.window_length)
return matrix_profile[:, 0].astype("float")
9 changes: 5 additions & 4 deletions aeon/transformations/series/_pla.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ class PLASeriesTransformer(BaseSeriesTransformer):
}

def __init__(self, max_error=20, transformer="swab", buffer_size=None):
self.transformer = transformer
self.max_error = max_error
self.transformer = transformer
self.buffer_size = buffer_size
super().__init__(axis=0)

Expand Down Expand Up @@ -255,11 +255,12 @@ def _SWAB(self, X):
List of transformed segmented time series.
"""
seg_ts = []
buffer_size = self.buffer_size
if self.buffer_size is None:
self.buffer_size = int(len(X) ** 0.5)
buffer_size = int(len(X) ** 0.5)

lower_boundary_window = int(self.buffer_size / 2)
upper_boundary_window = int(self.buffer_size * 2)
lower_boundary_window = int(buffer_size / 2)
upper_boundary_window = int(buffer_size * 2)

seg = self._best_line(X, 0, lower_boundary_window, upper_boundary_window)
current_data_point = len(seg)
Expand Down
13 changes: 7 additions & 6 deletions aeon/transformations/series/_siv.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,17 @@ def _transform(self, X, y=None):
-------
transformed version of X
"""
if self.window_length is None:
self.window_length = [3, 5, 7]
if not isinstance(self.window_length, list):
self.window_length = [self.window_length]
window_length = self.window_length
if window_length is None:
window_length = [3, 5, 7]
if not isinstance(window_length, list):
window_length = [window_length]

# Compute SIV
X_ = X

for window_length in self.window_length:
footprint = np.ones((1, window_length))
for w in window_length:
footprint = np.ones((1, w))
X_ = median_filter(X_, footprint=footprint)

return X_