From d88849cecff41b8e9ac0a56f804dd88b2a8b5a9f Mon Sep 17 00:00:00 2001 From: LouisCarpentier42 Date: Thu, 5 Dec 2024 12:05:51 +0100 Subject: [PATCH] Update tests --- .../test_LogisticRegressionSegmentor.py | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/tests/semantic_segmentation/test_LogisticRegressionSegmentor.py b/tests/semantic_segmentation/test_LogisticRegressionSegmentor.py index 3812050..d1bfd9d 100644 --- a/tests/semantic_segmentation/test_LogisticRegressionSegmentor.py +++ b/tests/semantic_segmentation/test_LogisticRegressionSegmentor.py @@ -50,28 +50,40 @@ def test_initialization_additional_args(self): with pytest.raises(TypeError): LogisticRegressionSegmentor(something_invalid=0) - def test_fit(self, pattern_based_embedding): + def test_fit(self): + univariate_time_series = np.sin(np.arange(0, 50, 0.05)) + np.random.normal(0, 0.25, 1000) + pattern_based_embedding = PatternBasedEmbedder().fit_transform(univariate_time_series) clf = LogisticRegressionSegmentor() assert clf.fit(pattern_based_embedding) == clf - def test_predict_proba(self, pattern_based_embedding): + def test_predict_proba(self): + univariate_time_series = np.sin(np.arange(0, 50, 0.05)) + np.random.normal(0, 0.25, 1000) + pattern_based_embedding = PatternBasedEmbedder().fit_transform(univariate_time_series) clf = LogisticRegressionSegmentor() clf.fit(pattern_based_embedding) pred = clf.predict_proba(pattern_based_embedding) assert pred.shape[0] == pattern_based_embedding.shape[1] - def test_fit_predict_proba(self, pattern_based_embedding): + def test_fit_predict_proba(self): + univariate_time_series = np.sin(np.arange(0, 50, 0.05)) + np.random.normal(0, 0.25, 1000) + pattern_based_embedding = PatternBasedEmbedder().fit_transform(univariate_time_series) pred = LogisticRegressionSegmentor().fit_predict_proba(pattern_based_embedding) assert pred.shape[0] == pattern_based_embedding.shape[1] - def test_fit_predict_proba_one_n_segment(self, pattern_based_embedding): + def test_fit_predict_proba_one_n_segment(self): + univariate_time_series = np.sin(np.arange(0, 50, 0.05)) + np.random.normal(0, 0.25, 1000) + pattern_based_embedding = PatternBasedEmbedder().fit_transform(univariate_time_series) pred = LogisticRegressionSegmentor(n_segments=3).fit_predict_proba(pattern_based_embedding) assert pred.shape == (pattern_based_embedding.shape[1], 3) - def test_fit_predict_proba_multiple_jobs(self, pattern_based_embedding): + def test_fit_predict_proba_multiple_jobs(self): + univariate_time_series = np.sin(np.arange(0, 50, 0.05)) + np.random.normal(0, 0.25, 1000) + pattern_based_embedding = PatternBasedEmbedder().fit_transform(univariate_time_series) pred = LogisticRegressionSegmentor(n_jobs=4).fit_predict_proba(pattern_based_embedding) assert pred.shape[0] == pattern_based_embedding.shape[1] - def test_predict_proba_not_fitted(self, pattern_based_embedding): + def test_predict_proba_not_fitted(self): + univariate_time_series = np.sin(np.arange(0, 50, 0.05)) + np.random.normal(0, 0.25, 1000) + pattern_based_embedding = PatternBasedEmbedder().fit_transform(univariate_time_series) with pytest.raises(NotFittedError): LogisticRegressionSegmentor().predict_proba(pattern_based_embedding)