faster rms
This commit is contained in:
+9
-5
@@ -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):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user