12 #ifndef MLPACK_METHODS_ANN_LOSS_FUNCTION_L1_LOSS_IMPL_HPP 13 #define MLPACK_METHODS_ANN_LOSS_FUNCTION_L1_LOSS_IMPL_HPP 21 template<
typename InputDataType,
typename OutputDataType>
28 template<
typename InputDataType,
typename OutputDataType>
29 template<
typename PredictionType,
typename TargetType>
30 typename PredictionType::elem_type
32 const PredictionType& prediction,
33 const TargetType& target)
36 return arma::accu(arma::mean(prediction - target));
38 return arma::accu(prediction - target);
41 template<
typename InputDataType,
typename OutputDataType>
42 template<
typename PredictionType,
typename TargetType,
typename LossType>
44 const PredictionType& prediction,
45 const TargetType& target,
48 loss = arma::sign(prediction - target);
51 template<
typename InputDataType,
typename OutputDataType>
52 template<
typename Archive>
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
void serialize(Archive &ar, const uint32_t)
Serialize the layer.
Definition: l1_loss_impl.hpp:53
void Backward(const PredictionType &prediction, const TargetType &target, LossType &loss)
Ordinary feed backward pass of a neural network.
Definition: l1_loss_impl.hpp:43
L1Loss(const bool mean=true)
Create the L1Loss object.
Definition: l1_loss_impl.hpp:22
PredictionType::elem_type Forward(const PredictionType &prediction, const TargetType &target)
Computes the L1 Loss function.
Definition: l1_loss_impl.hpp:31