Q: Keras: Custom loss function without any mean Different loss functions used by default in Keras, make use of average beetween all sample and all components. In particular, I used:
model_cnn_dense.compile(loss='mae', optimizer=opt)

With this I obtain apparently good results 1 cm of error of mea in my regression test, but looking at the data, the maximum absolute error in my sequence of data is about 20 cm, that is not good for my application.
There is a way to not take the mean of absolute error for all samples, but simply to take the maximum absolute error for all samples?
Thank you very much!

Added Example (Edit):
I want to obtain from the NN the values:
1,2,3
...
4,5,6
The reconstruction from the NN is:
1,2,6
...
4,5,6
So the mae obtained is:
(ABS(1-1)+ABS(2-2)+ABS(3-6)+...+ABS(4-4)+ABS(5-5)+ABS(6-6))/N

If N is just composed by the six shown elements, the final mae is 0.5 (really low value)
What I want to obtain is instead a loss function which do not give me the mean absolute error, but the maximum absolute error:
MAX(ABS(1-1),ABS(2-2),ABS(3-6), ..., ABS(4-4)+ABS(5-5)+ABS(6-6))

If N is just composed by the six shown elements, the final maximum absolute value is 3 (really different from 0.5)
This is my ideal loss function.
