This part of the project documentation focuses on
an information-oriented approach. Use it as a
reference for the technical implementation of the
mlpForecaster
project code.
evaluate_point_forecast
evaluate_point_forecast(outputs)
Evaluates point forecasts by computing daily pointwise metrics.
Parameters:
-
outputs
(dict
) –A dictionary containing the true values, predicted values, and associated metadata. Expected keys: 'true' (ndarray): The true values. 'loc' (ndarray): The predicted values. 'index' (ndarray): The timestamps for each prediction. 'targets' (list): The names of the target variables.
Returns:
-
tuple
–A tuple containing: - pd_metrics (dict): DataFrame of combined metrics for each target variable. - split_metrics (dict): Dictionary of metrics split by target variable. - logs (dict): Any additional logs generated during the evaluation.
Source code in mlpforecast/metrics/deterministic.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
|
get_nbias
get_nbias(y, y_hat, axis=0)
Calculates the normalized bias (NBias) between the true values and predicted values.
NBias is defined as the sum of the difference between the true values and predicted values, normalized by the sum of the true and predicted values.
Parameters:
-
y
(ndarray
) –The true values.
-
y_hat
(ndarray
) –The predicted values.
-
axis
(int
, default:0
) –The axis along which to compute the NBias. Default is 0.
Returns:
-
float
–The normalized bias value.
Source code in mlpforecast/metrics/deterministic.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
|
get_pointwise_metrics
get_pointwise_metrics(
pred: array, true: array, target_range: float = None
)
Calculate pointwise metrics
Parameters:
-
pred
(array
) –predicted values
-
true
(array
) –true values
-
target_range
(float
, default:None
) –range of the target variable
Returns:
-
dict
–pointwise metrics
Source code in mlpforecast/metrics/deterministic.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
|
get_smape
get_smape(y, y_hat, axis=0)
Calculates the Symmetric Mean Absolute Percentage Error (SMAPE) between the true values and predicted values.
SMAPE is defined as the average of the absolute percentage errors, normalized by the sum of the absolute values of the true and predicted values.
Parameters:
-
y
(ndarray
) –The true values.
-
y_hat
(ndarray
) –The predicted values.
-
axis
(int
, default:0
) –The axis along which to compute the SMAPE. Default is 0.
Returns:
-
float
–The symmetric mean absolute percentage error value.
Source code in mlpforecast/metrics/deterministic.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
|