From ec45c395fd432c178c4f6c2faa51c78fffa1781f Mon Sep 17 00:00:00 2001 From: "Mark J. Hoy" Date: Fri, 25 Apr 2025 08:19:23 -0400 Subject: [PATCH] add 9.0.1 for LTR rescoring (#790) --- tests/ml/test_ml_model_pytest.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tests/ml/test_ml_model_pytest.py b/tests/ml/test_ml_model_pytest.py index 71e1234..8816868 100644 --- a/tests/ml/test_ml_model_pytest.py +++ b/tests/ml/test_ml_model_pytest.py @@ -237,10 +237,17 @@ class TestMLModel: Normalized scores for the model. """ - if (ES_VERSION[0] == 8 and ES_VERSION >= (8, 19)) or ( - ES_VERSION >= (9, 1) or ES_IS_SERVERLESS - ): - # In 8.19 and 9.1, the scores are normalized if there are negative scores + should_rescore = ( + (ES_VERSION[0] == 8 and ES_VERSION >= (8, 19)) + or ( + ES_VERSION[0] == 9 + and (ES_VERSION[1] >= 1 or (ES_VERSION[1] == 0 and ES_VERSION[2] >= 1)) + ) + or ES_IS_SERVERLESS + ) + + if should_rescore: + # In 8.19+, 9.0.1 and 9.1, the scores are normalized if there are negative scores min_model_score, _ = ( get_model_transformer( ranker, feature_names=ltr_model_config.feature_names