From 23391c2fa4f5adaeb5001dec9147ff22be8f180b Mon Sep 17 00:00:00 2001 From: Alexander Hess Date: Tue, 2 Feb 2021 15:20:02 +0100 Subject: [PATCH] Adjust `OrderHistory.choose_tactical_model()` heuristic - use the `HorizontalSMAModel` for low demand - use the `TrivialModel` for no demand --- src/urban_meal_delivery/forecasts/timify.py | 6 ++---- tests/forecasts/timify/test_avg_daily_demand.py | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/urban_meal_delivery/forecasts/timify.py b/src/urban_meal_delivery/forecasts/timify.py index 92674f7..3c9a147 100644 --- a/src/urban_meal_delivery/forecasts/timify.py +++ b/src/urban_meal_delivery/forecasts/timify.py @@ -545,12 +545,10 @@ class OrderHistory: elif add >= 10: # = "medium demand" return models.HorizontalETSModel(order_history=self) elif add >= 2.5: # = "low demand" - # TODO: create HorizontalSMAModel - return models.HorizontalETSModel(order_history=self) + return models.HorizontalSMAModel(order_history=self) # = "no demand" - # TODO: create HorizontalTrivialModel - return models.HorizontalETSModel(order_history=self) + return models.TrivialModel(order_history=self) raise RuntimeError( 'no rule for the given average daily demand and training horizon', diff --git a/tests/forecasts/timify/test_avg_daily_demand.py b/tests/forecasts/timify/test_avg_daily_demand.py index c8ab66f..4ad3c15 100644 --- a/tests/forecasts/timify/test_avg_daily_demand.py +++ b/tests/forecasts/timify/test_avg_daily_demand.py @@ -112,8 +112,7 @@ class TestChooseTacticalModel: train_horizon=test_config.LONG_TRAIN_HORIZON, ) - # TODO: this should be the future `HorizontalSMAModel`. - assert isinstance(result, models.HorizontalETSModel) + assert isinstance(result, models.HorizontalSMAModel) def test_best_model_with_no_demand( self, order_history, good_pixel_id, predict_at, @@ -127,8 +126,7 @@ class TestChooseTacticalModel: train_horizon=test_config.LONG_TRAIN_HORIZON, ) - # TODO: this should be the future `HorizontalTrivialModel`. - assert isinstance(result, models.HorizontalETSModel) + assert isinstance(result, models.TrivialModel) def test_best_model_for_unknown_train_horizon( self, order_history, good_pixel_id, predict_at, # noqa:RST215