def test_find(self, jhu_data, population_data, country): warnings.simplefilter("ignore", category=DeprecationWarning) warnings.simplefilter("ignore", category=UserWarning) population = population_data.value(country) sr_df = jhu_data.to_sr(country=country, population=population) change_finder = ChangeFinder(sr_df) change_finder.run() change_finder.show(area=jhu_data.area_name(country=country)) assert isinstance(change_finder.date_range(), tuple)
def test_find(self, jhu_data, population_data, country, max_rmsle=20.0): # Setup population = population_data.value(country) sr_df = jhu_data.to_sr(country=country, population=population) # Find change points change_finder = ChangeFinder(sr_df, max_rmsle=max_rmsle) change_finder.run() # For all phases, check if RMSLE score is lower than max_rmsle=20.0 for (start_date, end_date) in zip(*change_finder.date_range()): phase_df = jhu_data.to_sr(country=country, population=population, start_date=start_date, end_date=end_date) rmsle = Trend(sr_df=phase_df).rmsle() assert rmsle < max_rmsle