MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / root_mean_square_error

Function root_mean_square_error

computer_vision/haralick_descriptors.py:10–22  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

8
9
10def 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
25def normalize_image(

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected