@@ -239,10 +239,11 @@ def test_neural_forecast_fit_cross_validation(setup_airplane_data):
239239 pd .testing .assert_frame_equal (after_fcst , init_fcst )
240240
241241
242- # cross_validation() with no `df` should reuse the stored dataset
242+ # cross_validation() with no `df` should reuse the stored dataset.
243+ @pytest .mark .parametrize ("local_scaler_type" , [None , "standard" ])
243244@pytest .mark .parametrize ("use_polars" , [False , True ])
244245def test_cross_validation_without_df_uses_stored_dataset (
245- use_polars , setup_airplane_data , setup_airplane_data_polars
246+ use_polars , local_scaler_type , setup_airplane_data , setup_airplane_data_polars
246247):
247248 if use_polars :
248249 df , _ = setup_airplane_data_polars
@@ -256,11 +257,12 @@ def test_cross_validation_without_df_uses_stored_dataset(
256257 assert_frame_equal = pd .testing .assert_frame_equal
257258
258259 models = [NHITS (h = 12 , input_size = 24 , max_steps = 2 , random_seed = 0 )]
259- nf = NeuralForecast (models = models , freq = freq )
260+ nf = NeuralForecast (models = models , freq = freq , local_scaler_type = local_scaler_type )
260261 nf .fit (df , ** col_kwargs )
261262 # use_init_models resets to the same seeded weights before each run
262263 cv_with_df = nf .cross_validation (df , use_init_models = True , ** col_kwargs )
263- cv_no_df = nf .cross_validation (use_init_models = True , ** col_kwargs )
264+ # No column kwargs here: the stored dataset's column names must be preserved.
265+ cv_no_df = nf .cross_validation (use_init_models = True )
264266 assert_frame_equal (cv_no_df , cv_with_df )
265267
266268
0 commit comments