Skip to content

Commit 60c6daa

Browse files
authored
Fix date format in cross-validation for auto-select (#1093)
2 parents 71efc26 + 48af2e6 commit 60c6daa

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

ads/opctl/operator/lowcode/forecast/model_evaluator.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ def create_operator_config(self, operator_config, backtest, model, historical_da
100100
backtest_op_config_draft = operator_config.to_dict()
101101
backtest_spec = backtest_op_config_draft["spec"]
102102
backtest_spec["historical_data"]["url"] = historical_data_url
103+
backtest_spec["datetime_column"]["format"] = None
103104
if backtest_spec["additional_data"]:
104105
backtest_spec["additional_data"]["url"] = additional_data_url
105106
backtest_spec["test_data"] = {}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Store,Date,Sales
2+
1,01-07-2022,328
3+
1,01-08-2022,369
4+
1,01-09-2022,415
5+
1,01-10-2022,277
6+
1,01-11-2022,248
7+
1,01-12-2022,251
8+
1,01-07-2023,329
9+
1,01-08-2023,446

tests/operators/forecast/test_errors.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -868,5 +868,30 @@ def test_what_if_analysis(operator_setup, model):
868868
), f"Deployment info file not found at {deployment_metadata}"
869869

870870

871+
def test_auto_select(operator_setup):
872+
DATASET_PREFIX = f"{os.path.dirname(os.path.abspath(__file__))}/../data/timeseries/"
873+
tmpdirname = operator_setup
874+
historical_test_path = f"{DATASET_PREFIX}/dataset6.csv"
875+
model = "auto-select"
876+
yaml_i, output_data_path = populate_yaml(
877+
tmpdirname=tmpdirname,
878+
historical_data_path=historical_test_path,
879+
output_data_path=f"{tmpdirname}/{model}/results",
880+
)
881+
yaml_i["spec"].pop("additional_data")
882+
yaml_i["spec"]["horizon"] = 2
883+
yaml_i["spec"]["datetime_column"]["format"] = "%d-%m-%Y"
884+
yaml_i["spec"]["model"] = model
885+
yaml_i["spec"]["model_kwargs"] = {"model_list": ["prophet", "arima"]}
886+
887+
run_yaml(
888+
tmpdirname=tmpdirname,
889+
yaml_i=yaml_i,
890+
output_data_path=output_data_path,
891+
test_metrics_check=False,
892+
)
893+
report_path = f"{output_data_path}/report.html"
894+
assert os.path.exists(report_path), f"Report file not found at {report_path}"
895+
871896
if __name__ == "__main__":
872897
pass

0 commit comments

Comments
 (0)