def test_root_normalized_mean_absolute_error():
 max_rating = 5.0
 min_rating = 1.0
 y_real = np.array([0.0, 1.0, 0.0, 2.0, 3.0])
 y_pred = np.array([0.0, 1.0, 0.0, 2.0, 3.0])
 assert_equals(0.0, normalized_mean_absolute_error(y_real, y_pred, max_rating, min_rating))
 y_real = np.array([3.0, 1.0, 2.0, 1.0, 1.0])
 y_pred = np.array([0.0, 1.0, 0.0, 2.0, 3.0])
 assert_almost_equals(0.4, normalized_mean_absolute_error(y_real, y_pred, max_rating, min_rating))

def test_root_normalized_mean_absolute_error ( ) : max_rating = 5.0 min_rating = 1.0 y_real = np . array ( [ 0.0 , 1.0 , 0.0 , 2.0 , 3.0 ] ) y_pred = np . array ( [ 0.0 , 1.0 , 0.0 , 2.0 , 3.0 ] ) assert_equals ( 0.0 , normalized_mean_absolute_error ( y_real , y_pred , max_rating , min_rating ) ) y_real = np . array ( [ 3.0 , 1.0 , 2.0 , 1.0 , 1.0 ] ) y_pred = np . array ( [ 0.0 , 1.0 , 0.0 , 2.0 , 3.0 ] ) assert_almost_equals ( 0.4 , normalized_mean_absolute_error ( y_real , y_pred , max_rating , min_rating ) )
check that the metric normalized mean absolute error .