Skip to content
Snippets Groups Projects
Commit eb45a440 authored by Tamino Huxohl's avatar Tamino Huxohl
Browse files

update nmae code to allow setting external max and min value

parent 107099ef
No related branches found
No related tags found
No related merge requests found
......@@ -7,9 +7,15 @@ def mse(prediction: np.array, target: np.array):
return mse
def nmae(prediction: np.array, target: np.array):
mae = np.absolute(prediction - target) / prediction.size
nmae = mae.sum() / (target.max() - target.min())
def nmae(prediction: np.array, target: np.array, vmax:float=None, vmin:float=None):
if vmax is None:
vmax = target.max()
if vmin is None:
vmin = target.min()
ae = np.absolute(prediction - target)
mae = ae.sum() / ae.size
nmae = mae / (vmax - vmin)
return nmae
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment