Adjust OrderHistory.choose_tactical_model() heuristic

- use the `HorizontalSMAModel` for low demand
- use the `TrivialModel` for no demand
This commit is contained in:
Alexander Hess 2021-02-02 15:20:02 +01:00
parent 3f5b4a50bb
commit 23391c2fa4
Signed by: alexander
GPG key ID: 344EA5AB10D868E0
2 changed files with 4 additions and 8 deletions

View file

@ -545,12 +545,10 @@ class OrderHistory:
elif add >= 10: # = "medium demand" elif add >= 10: # = "medium demand"
return models.HorizontalETSModel(order_history=self) return models.HorizontalETSModel(order_history=self)
elif add >= 2.5: # = "low demand" elif add >= 2.5: # = "low demand"
# TODO: create HorizontalSMAModel return models.HorizontalSMAModel(order_history=self)
return models.HorizontalETSModel(order_history=self)
# = "no demand" # = "no demand"
# TODO: create HorizontalTrivialModel return models.TrivialModel(order_history=self)
return models.HorizontalETSModel(order_history=self)
raise RuntimeError( raise RuntimeError(
'no rule for the given average daily demand and training horizon', 'no rule for the given average daily demand and training horizon',

View file

@ -112,8 +112,7 @@ class TestChooseTacticalModel:
train_horizon=test_config.LONG_TRAIN_HORIZON, train_horizon=test_config.LONG_TRAIN_HORIZON,
) )
# TODO: this should be the future `HorizontalSMAModel`. assert isinstance(result, models.HorizontalSMAModel)
assert isinstance(result, models.HorizontalETSModel)
def test_best_model_with_no_demand( def test_best_model_with_no_demand(
self, order_history, good_pixel_id, predict_at, self, order_history, good_pixel_id, predict_at,
@ -127,8 +126,7 @@ class TestChooseTacticalModel:
train_horizon=test_config.LONG_TRAIN_HORIZON, train_horizon=test_config.LONG_TRAIN_HORIZON,
) )
# TODO: this should be the future `HorizontalTrivialModel`. assert isinstance(result, models.TrivialModel)
assert isinstance(result, models.HorizontalETSModel)
def test_best_model_for_unknown_train_horizon( def test_best_model_for_unknown_train_horizon(
self, order_history, good_pixel_id, predict_at, # noqa:RST215 self, order_history, good_pixel_id, predict_at, # noqa:RST215