faster rms
This commit is contained in:
parent
151b61a80f
commit
9a0d0a3e10
@ -10,11 +10,15 @@ def rms(errors):
|
||||
"""
|
||||
root mean square calculation
|
||||
"""
|
||||
r = 0.0
|
||||
for i in errors:
|
||||
r += np.power(i, 2)
|
||||
r = np.sqrt(r / len(errors))
|
||||
return r
|
||||
|
||||
# slow pure python way for reference:
|
||||
# r = 0.0
|
||||
# for i in errors:
|
||||
# r += np.power(i, 2)
|
||||
# r = np.sqrt(r / len(errors))
|
||||
# return r
|
||||
|
||||
return np.sqrt((errors**2).mean())
|
||||
|
||||
def baker_exact_2D(X):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user