@@ -414,43 +414,43 @@ def run_operator(
414414# generate_train_metrics = True
415415
416416
417- # def test_missing_data_autoselect_series():
418- # """Test case for auto-select-series with missing data."""
419- # data = {
420- # "Date": pd.to_datetime(
421- # [
422- # "2023-01-01",
423- # "2023-01-02",
424- # "2023-01-03",
425- # "2023-01-04",
426- # "2023-01-05",
427- # "2023-01-06",
428- # "2023-01-07",
429- # "2023-01-08",
430- # "2023-01-09",
431- # "2023-01-10",
432- # ]
433- # ),
434- # "Y": [1, 2, np.nan, 4, 5, 6, 7, 8, 9, 10],
435- # "Category": ["A", "A", "A", "A", "A", "A", "A", "A", "A", "A"],
436- # }
437- # df = pd.DataFrame(data)
417+ def test_missing_data_autoselect_series ():
418+ """Test case for auto-select-series with missing data."""
419+ data = {
420+ "Date" : pd .to_datetime (
421+ [
422+ "2023-01-01" ,
423+ "2023-01-02" ,
424+ "2023-01-03" ,
425+ "2023-01-04" ,
426+ "2023-01-05" ,
427+ "2023-01-06" ,
428+ "2023-01-07" ,
429+ "2023-01-08" ,
430+ "2023-01-09" ,
431+ "2023-01-10" ,
432+ ]
433+ ),
434+ "Y" : [1 , 2 , np .nan , 4 , 5 , 6 , 7 , 8 , 9 , 10 ],
435+ "Category" : ["A" , "A" , "A" , "A" , "A" , "A" , "A" , "A" , "A" , "A" ],
436+ }
437+ df = pd .DataFrame (data )
438438
439- # with tempfile.TemporaryDirectory() as tmpdirname:
440- # output_data_path = f"{tmpdirname}/results"
441- # yaml_i = deepcopy(TEMPLATE_YAML)
442- # yaml_i["spec"]["model"] = "auto-select-series"
443- # yaml_i["spec"]["historical_data"].pop("url")
444- # yaml_i["spec"]["historical_data"]["data"] = df
445- # yaml_i["spec"]["target_column"] = "Y"
446- # yaml_i["spec"]["datetime_column"]["name"] = "Date"
447- # yaml_i["spec"]["target_category_columns"] = ["Category"]
448- # yaml_i["spec"]["horizon"] = 2
449- # yaml_i["spec"]["output_directory"]["url"] = output_data_path
450-
451- # operator_config = ForecastOperatorConfig.from_dict(yaml_i)
452- # forecast_operate(operator_config)
453- # check_output_for_errors(output_data_path)
439+ with tempfile .TemporaryDirectory () as tmpdirname :
440+ output_data_path = f"{ tmpdirname } /results"
441+ yaml_i = deepcopy (TEMPLATE_YAML )
442+ yaml_i ["spec" ]["model" ] = "auto-select-series"
443+ yaml_i ["spec" ]["historical_data" ].pop ("url" )
444+ yaml_i ["spec" ]["historical_data" ]["data" ] = df
445+ yaml_i ["spec" ]["target_column" ] = "Y"
446+ yaml_i ["spec" ]["datetime_column" ]["name" ] = "Date"
447+ yaml_i ["spec" ]["target_category_columns" ] = ["Category" ]
448+ yaml_i ["spec" ]["horizon" ] = 2
449+ yaml_i ["spec" ]["output_directory" ]["url" ] = output_data_path
450+
451+ operator_config = ForecastOperatorConfig .from_dict (yaml_i )
452+ forecast_operate (operator_config )
453+ check_output_for_errors (output_data_path )
454454
455455
456456if __name__ == "__main__" :
0 commit comments