:py:mod:`orcanet_contrib.custom_objects` ======================================== .. py:module:: orcanet_contrib.custom_objects Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: orcanet_contrib.custom_objects.get_custom_objects orcanet_contrib.custom_objects.loss_mean_relative_error_energy orcanet_contrib.custom_objects.loss_uncertainty_mae orcanet_contrib.custom_objects.loss_uncertainty_mse orcanet_contrib.custom_objects.loss_uncertainty_gaussian_likelihood orcanet_contrib.custom_objects.loss_uncertainty_gaussian_likelihood_dir orcanet_contrib.custom_objects.loss_direction orcanet_contrib.custom_objects.loss_direction_grad orcanet_contrib.custom_objects.mean_absolute_error Attributes ~~~~~~~~~~ .. autoapisummary:: orcanet_contrib.custom_objects.dir_y_true .. py:function:: get_custom_objects() Functions that returns a dict with all relevant loss functions in this file. .. !! processed by numpydoc !! .. py:function:: loss_mean_relative_error_energy(y_true, y_pred) Loss function that calculates the mean relative error. y_true & y_pred are expected to be e_true & e_pred. L = (e_reco - e_true) / e_true :Returns: **mre** : Mean relative (energy) error loss .. .. !! processed by numpydoc !! .. py:function:: loss_uncertainty_mae(y_true, y_pred) Mean absolute error loss for the uncertainty estimation. L = sigma_pred / abs(label_true - label_reco). :Returns: **loss** : Mean absolute error for uncertainty estimations. .. .. !! processed by numpydoc !! .. py:function:: loss_uncertainty_mse(y_true, y_pred) Mean squared error loss for the uncertainty estimation. L = sigma_pred / abs(label_true - label_reco)**2. :Returns: **loss** : Mean squared error for uncertainty estimations. .. .. !! processed by numpydoc !! .. py:function:: loss_uncertainty_gaussian_likelihood(y_true, y_pred) Loss function that calculates something similar to a Gaussian Likelihood. Requires that y_pred contains only one predicted value (label). y_true & y_pred are expected to contain the predicted/true label and the predicted std for the label. L = ln(std ** 2) + (y_label_pred - y_label_true) / (std ** 2) :Returns: **loss** : Gaussian Likelihood loss .. .. !! processed by numpydoc !! .. py:function:: loss_uncertainty_gaussian_likelihood_dir(y_true, y_pred) Loss function that calculates something similar to a Gaussian Likelihood for predicted directions. Requires that y_pred contains three predicted values (labels): dir_x, dir_y, dir_z. y_true & y_pred are expected to contain the predicted/true label and the predicted std for the label. L = ln(std ** 2) + (y_label_pred - y_label_true) / (std ** 2) :Returns: **loss** : Gaussian Likelihood loss for the directional error .. .. !! processed by numpydoc !! .. py:function:: loss_direction(y_true, y_pred) Loss function that calculates the space angle between the predicted and the true direction. Not used anymore, can lead to inf gradients due to tf.acos(space_angle_inner_value)! Converts cartesian dirs to spherical coordinate system and then calculates the space angle between the two vectors. :Returns: **total_loss** : Space angle loss .. .. !! processed by numpydoc !! .. py:function:: loss_direction_grad() Similar loss function as in loss_direction, but here it is just used for manually calculating the gradient in the main function. Done in order to protect the loss_direction function from inf gradients. .. !! processed by numpydoc !! .. py:function:: mean_absolute_error(y_true, y_pred) Copy of the Keras mean absolute error function for testing purposes. .. !! processed by numpydoc !! .. py:data:: dir_y_true