Skip to content
Snippets Groups Projects
Commit 5923b72a authored by lukas leufen's avatar lukas leufen
Browse files

moved loss and updated docstrings

parent 07a84533
Branches
No related tags found
3 merge requests!125Release v0.10.0,!124Update Master to new version v0.10.0,!91WIP: Resolve "create sphinx docu"
Pipeline #35070 failed
"""Collection of different customised loss functions."""
from keras import backend as K
from typing import Callable
def l_p_loss(power: int) -> Callable:
"""
Calculate the L<p> loss for given power p.
L1 (p=1) is equal to mean absolute error (MAE), L2 (p=2) is to mean squared error (MSE), ...
:param power: set the power of the error calculus
:return: loss for given power
"""
def loss(y_true, y_pred):
return K.mean(K.pow(K.abs(y_pred - y_true), power), axis=-1)
return loss
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment