cross_val_predict¶
yohou.model_selection.validation.cross_val_predict(forecaster, y, X_actual=None, forecasting_horizon=1, *, X_future=None, X_forecast=None, cv=5, predict_forecasting_horizon=None, predict_stride=None, coverage_rates=None, n_jobs=None, verbose=0, pre_dispatch='2*n_jobs', method='predict')
¶
Generate cross-validated predictions for each fold.
For each CV fold, the forecaster is fitted on the training data
and predictions are produced on the test data. Predictions from
all folds are concatenated into a single DataFrame with a
"split" column identifying the originating fold.
Parameters¶
| Name | Type | Description | Default |
|---|---|---|---|
forecaster
|
BaseForecaster
|
The forecaster to evaluate. |
required |
y
|
DataFrame
|
Target time series with a |
required |
X_actual
|
DataFrame or None
|
Actual feature observations with a |
None
|
forecasting_horizon
|
int
|
Number of time steps to forecast. |
1
|
X_future
|
DataFrame or None
|
Known future features with a |
None
|
X_forecast
|
DataFrame or None
|
External forecasts with |
None
|
cv
|
int, BaseSplitter, or None
|
Cross-validation splitting strategy. |
5
|
predict_forecasting_horizon
|
int or None
|
Override forecasting horizon for |
None
|
predict_stride
|
int or None
|
Override stride for |
None
|
coverage_rates
|
list of float or None
|
Coverage rates for interval predictions. Only used when
|
None
|
n_jobs
|
int or None
|
Number of parallel jobs. |
None
|
verbose
|
int
|
Verbosity level. |
0
|
pre_dispatch
|
str or int
|
Controls pre-dispatched jobs for parallel execution. |
"2*n_jobs"
|
method
|
str
|
Prediction method: |
"predict"
|
Returns¶
| Type | Description |
|---|---|
DataFrame
|
Concatenated predictions from all folds with an integer
|
Source Code¶
Show/Hide source
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 | |
Tutorials¶
The following example notebooks use this component:
-
Cross-Validation for Time Series
Evaluation-Search
Evaluate forecasters with cross_val_score, cross_validate, and cross_val_predict using temporal splitters.