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 create_case(self, **components): return Case(Components(**components), Context())
def create_model(self, params): return Model(params, Context())
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 setup_method(self, method): self.context = Context()