@@ -145,6 +145,31 @@ def test_when_multivariate_task_is_created_then_data_contains_correct_columns(ta
145145 assert set (future_data .column_names ) == set (all_column_names ) - set (target_column )
146146
147147
148+ @pytest .mark .parametrize ("return_list" , [True , False ])
149+ def test_when_predictions_provided_as_dataset_dict_for_univariate_task_then_predictions_can_be_scores (return_list ):
150+ def naive_forecast_univariate (task : fev .Task ) -> list [dict ]:
151+ past_data , future_data = task .get_input_data ()
152+ predictions = []
153+ for ts in past_data :
154+ predictions .append ({"predictions" : [ts [task .target_column ][- 1 ] for _ in range (task .horizon )]})
155+ if return_list :
156+ return predictions
157+ else :
158+ return datasets .DatasetDict ({task .target_column : datasets .Dataset .from_list (predictions )})
159+
160+ task = fev .Task (
161+ dataset_path = "autogluon/chronos_datasets" ,
162+ dataset_config = "monash_m1_yearly" ,
163+ eval_metric = "MASE" ,
164+ extra_metrics = ["WAPE" ],
165+ horizon = 4 ,
166+ )
167+ predictions = naive_forecast_univariate (task )
168+ summary = task .evaluation_summary (predictions , model_name = "naive" )
169+ for metric in ["MASE" , "WAPE" ]:
170+ assert np .isfinite (summary [metric ])
171+
172+
148173@pytest .mark .parametrize ("target_column" , [["OT" ], ["OT" , "LULL" , "HULL" ]])
149174@pytest .mark .parametrize ("return_dict" , [True , False ])
150175def test_when_multivariate_task_is_used_then_predictions_can_be_scored (target_column , return_dict ):
0 commit comments