| 123456789101112 |
- import numpy as np
- from sklearn.metrics import mean_squared_error, mean_absolute_error, mean_absolute_percentage_error
- def calculate_rmse(list_a, list_b):
- assert len(list_a) == len(list_b) and len(list_a) > 0 and len(list_b) > 0
- return np.sqrt(mean_squared_error(list_a, list_b))
- def calculate_mae(list_a, list_b):
- assert len(list_a) == len(list_b) and len(list_a) > 0 and len(list_b) > 0
- return mean_absolute_error(list_a, list_b)
|