Skip to content
Snippets Groups Projects
Select Git revision
  • a0802ea992df6b4c7ee4f445e9c1c7fb3515d1e0
  • master default
  • rename_category_group
  • php8.1_deprecations
  • v1.12.1
  • v1.13
  • v1.12
  • v1.11
  • v1.10
  • v1.9
  • v1.8
  • v1.7
  • v1.6
  • v1.5
  • v1.4
  • v1.3
  • v1.2
  • v1.1
  • v1.0
19 results

EventManagement.php

Blame
  • loss.py 526 B
    """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