def test_calculate_max_better(self, seasonal_periods, expected_max_harmonics): strategy = HarmonicsChoosingStrategy(Context(), checking_range=1) harmonics = strategy.calculate_max( np.asarray(seasonal_periods), HarmonicsChoosingStrategy.max_harmonic_dependency_reduction_better ) assert np.array_equal(expected_max_harmonics, harmonics)
def test_next_harmonics_to_check(self, n_jobs, max_harmonic, chosen_harmonic, previous_range, expected_range): strategy = HarmonicsChoosingStrategy(Context(), checking_range=n_jobs) obtained_range = strategy.next_harmonics_to_check( max_harmonic=max_harmonic, previously_checked=previous_range, chosen_harmonic=chosen_harmonic ) assert np.array_equal(expected_range, obtained_range)
def test_initial_harmonics_to_check(self, n_jobs, max_harmonic, expected_range): strategy = HarmonicsChoosingStrategy(Context(), checking_range=n_jobs) obtained_range = strategy.initial_harmonics_to_check(max_harmonic) assert np.array_equal(expected_range, obtained_range)
def test_calculate_max(self, seasonal_periods, expected_max_harmonics): strategy = HarmonicsChoosingStrategy(Context(), checking_range=1) harmonics = strategy.calculate_max(np.array(seasonal_periods)) assert np.array_equal(expected_max_harmonics, harmonics)
def test_choose(self, components, aic_score_map, expected_harmonics): context = self.ContextMock(aic_score_map) strategy = HarmonicsChoosingStrategy(context, checking_range=1) harmonics = strategy.choose([1, 2, 3], Components(**components)) assert np.array_equal(expected_harmonics, harmonics)