performance
Description
This function receives true_values and predicted_values and a list of performance measures as input from the user and returns the performance measures between true_values and predicted_values.
Usage
- predict.performance(true_values, predicted_values, performance_measures=['MAPE'], trivial_values=[], model_type='regression', num_params=1, labels=None)
Parameters
# |
Input Name |
Input Description |
|---|---|---|
1
|
true_values
|
type: list <float>
default: -
details: ground truth for target values.
|
2
|
predicted_values
|
type: list <float> or list<list<float>>
default: -
details: predicted values for the target or the predicted
probability for each class of the target variable.
|
3
|
performance_measures
|
type: list<{‘MAE’, ‘MAPE’, ‘MASE’, ‘MSE’, ‘R2_score’, ‘AUC’,
‘AUPR’, ‘likelihood’, ‘AIC’, ‘BIC’}>
default: [‘MAPE’]
details: a list of performance measures.
example: [‘MAE’, ‘MAPE’]
|
4
|
trivial_values
|
type: list <float>
default: []
details: The actual values from the prior season of the time
series to calculate the mean absolute scaled error by considering the
forecast horizon as the seasonal period .
|
5
|
model_type
|
type: {‘regression’,’classification’}
default: ‘regression’
details: type of the prediction task which produced
predicted_values.
|
6
|
num_params
|
type: int
default: 1
details: number of independent parameters of the model which
produced predicted_values. Only be used to calculate the ‘AIC’ and
‘BIC’ measures.
|
7
|
labels
|
type: list<any type> or None
default: None
details: The class labels of the target variable.
|
Returns
# |
Output Name |
Output Description |
|---|---|---|
1
|
errors
|
type: list <float>
default: -
details: a list of errors based on the performace_measures input
and between true_values and predicted_values.
Note if ture_values contains at least one zero value then for ‘MAPE’, a warning
for division by zero will be displayed.
|
Example
import pandas as pd
from stpredict.predict import performance
true_values_list = [1, 3, 2, 2, 3, 1]
predicted_values_list = [[0.7,0.3,0.0], [0.2,0.0,0.8], [0.1,0.3,06],
[0.9,0.1,0.0], [1.0,0.0,0.0], [0.6,0.2,0.2]]
errors = performance(true_values = true_values_list,
predicted_values = predicted_values_list, performance_measures=['AUC'], labels=[1,2,3])