MCPcopy Create free account
hub / github.com/IntelligentSystemsLab/ST-EVCDP / metrics

Function metrics

functions.py:64–84  ·  view source on GitHub ↗
(test_pre, test_real)

Source from the content-addressed store, hash-verified

62
63
64def metrics(test_pre, test_real):
65 eps = 0.01
66 MAPE_test_real = test_real
67 MAPE_test_pre = test_pre
68 MAPE_test_real[np.where(MAPE_test_real == 0)] = MAPE_test_real[np.where(MAPE_test_real == 0)] + eps
69 MAPE_test_pre[np.where(MAPE_test_real == 0)] = MAPE_test_pre[np.where(MAPE_test_real == 0)] + eps
70 MAPE = mean_absolute_percentage_error(MAPE_test_real, MAPE_test_pre)
71 MAE = mean_absolute_error(test_real, test_pre)
72 MSE = mean_squared_error(test_real, test_pre)
73 RMSE = np.sqrt(MSE)
74 R2 = r2_score(test_real, test_pre)
75 RAE = np.sum(abs(test_pre - test_real)) / np.sum(abs(np.mean(test_real) - test_real))
76 operator = 100
77 print('MAPE: {}%'.format(MAPE*operator))
78 print('MAE:{}*10^-2'.format(MAE*operator))
79 print('MSE:{}*10^-2'.format(MSE*operator))
80 print('RMSE:{}*10^-2'.format(RMSE*operator))
81 print('R2:{}%'.format(R2*operator))
82 print(('RAE:{}%'.format(RAE*operator)))
83 output_list = [MSE, RMSE, MAPE, RAE, MAE, R2]
84 return output_list
85
86
87class CreateDataset(Dataset):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected