Simple implementation of Root Mean Squared Error for two N dimensional numpy arrays. Examples: >>> root_mean_square_error(np.array([1, 2, 3]), np.array([1, 2, 3])) 0.0 >>> root_mean_square_error(np.array([1, 2, 3]), np.array([2, 2, 2])) 0.816496580927726
(original: np.ndarray, reference: np.ndarray)
| 8 | |
| 9 | |
| 10 | def root_mean_square_error(original: np.ndarray, reference: np.ndarray) -> float: |
| 11 | """Simple implementation of Root Mean Squared Error |
| 12 | for two N dimensional numpy arrays. |
| 13 | |
| 14 | Examples: |
| 15 | >>> root_mean_square_error(np.array([1, 2, 3]), np.array([1, 2, 3])) |
| 16 | 0.0 |
| 17 | >>> root_mean_square_error(np.array([1, 2, 3]), np.array([2, 2, 2])) |
| 18 | 0.816496580927726 |
| 19 | >>> root_mean_square_error(np.array([1, 2, 3]), np.array([6, 4, 2])) |
| 20 | 3.1622776601683795 |
| 21 | """ |
| 22 | return float(np.sqrt(((original - reference) ** 2).mean())) |
| 23 | |
| 24 | |
| 25 | def normalize_image( |
nothing calls this directly
no outgoing calls
no test coverage detected