MC_metric
timecave.validation_strategy_metrics.MC_metric(estimated_error_list, test_error_list, metric)
Compute validation strategy metrics for N different experiments (MC stands for Monte Carlo).
This function processes the results of a Monte Carlo experiment and outputs a statistical summary of the results. This can be useful if one needs to analyse the performance of a given validation method on several different time series or using different models.
Users may provide a custom metric if they so desire, but it must have the same function signature as the metrics provided by this package.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
estimated_error_list |
list[float | int]
|
List of estimated (i.e. validation) errors, one for each experiment / trial. |
required |
test_error_list |
list[float | int]
|
List of test errors, one for each experiment / trial. |
required |
metric |
callable
|
Validation strategy metric. |
required |
Returns:
| Type | Description |
|---|---|
dict
|
A statistical summary of the results. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the estimator error list and the test error list differ in length. |
See also
under_over_estimation: Computes separate statistics for overestimation and underestimation cases.
Examples:
>>> from timecave.validation_strategy_metrics import PAE, MC_metric
>>> true_errors = [10, 30, 10, 50];
>>> validation_errors = [20, 20, 50, 30];
>>> MC_metric(validation_errors, true_errors, PAE)
{'Mean': 5.0, 'Median': 0.0, '1st_Quartile': -12.5, '3rd_Quartile': 17.5, 'Minimum': -20.0, 'Maximum': 40.0, 'Standard_deviation': 22.9128784747792}
If the lengths of the estimated error and test error lists do not match, an exception is thrown:
>>> MC_metric(validation_errors, [10], PAE)
Traceback (most recent call last):
...
ValueError: The estimated error and test error lists must have the same length.
Source code in timecave/validation_strategy_metrics.py
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 | |