Utility methods
This page contains the utility methods for converting input data and predictions.
Functions
convert_input_data(window: EvaluationWindow, adapter: Literal['pandas', 'datasets', 'gluonts', 'nixtla', 'darts', 'autogluon'] = 'pandas', *, as_univariate: bool = False, univariate_target_column: str = 'target', **kwargs) -> Any
Convert the output of task.get_input_data() to a format compatible with popular forecasting frameworks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
window
|
EvaluationWindow
|
Evaluation window for which input data must be converted. |
required |
adapter
|
('pandas', 'datasets', 'gluonts', 'nixtla', 'darts', 'autogluon')
|
Format to which the dataset must be converted. |
"pandas"
|
as_univariate
|
bool
|
If Setting Use |
False
|
univariate_target_column
|
str
|
Target column name used when |
'target'
|
**kwargs
|
Keyword arguments passed to |
{}
|
Source code in src/fev/adapters.py
381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 | |
combine_univariate_predictions_to_multivariate(predictions: datasets.Dataset | list[dict] | datasets.DatasetDict | dict[str, list[dict]], target_columns: list[str]) -> datasets.DatasetDict
Combine univariate predictions back into multivariate format.
Assumes predictions are ordered by cycling through target columns. For example: if target_columns = ["X", "Y"],
predictions should be ordered as [item1_X, item1_Y, item2_X, item2_Y, ...].
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
predictions
|
Dataset | list[dict] | DatasetDict | dict[str, list[dict]]
|
Univariate predictions for a single evaluation window. For the list of accepted types, see |
required |
target_columns
|
list[str]
|
List of target columns in the original |
required |
Returns:
| Type | Description |
|---|---|
DatasetDict
|
Predictions for the evaluation window converted to multivariate format. |
Source code in src/fev/utils.py
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 | |