12 #ifndef MLPACK_METHODS_ANN_LOSS_FUNCTION_MEAN_SQUARED_LOGARITHMIC_ERROR_IMPL_HPP 13 #define MLPACK_METHODS_ANN_LOSS_FUNCTION_MEAN_SQUARED_LOGARITHMIC_ERROR_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)
35 return arma::accu(arma::square(arma::log(1. + target) -
36 arma::log(1. + prediction))) / target.n_cols;
39 template<
typename InputDataType,
typename OutputDataType>
40 template<
typename PredictionType,
typename TargetType,
typename LossType>
42 const PredictionType& prediction,
43 const TargetType& target,
46 loss = 2 * (arma::log(1. + prediction) - arma::log(1. + target)) /
47 ((1. + prediction) * target.n_cols);
50 template<
typename InputDataType,
typename OutputDataType>
51 template<
typename Archive>
PredictionType::elem_type Forward(const PredictionType &prediction, const TargetType &target)
Computes the mean squared logarithmic error function.
Definition: mean_squared_logarithmic_error_impl.hpp:31
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: mean_squared_logarithmic_error_impl.hpp:52
MeanSquaredLogarithmicError()
Create the MeanSquaredLogarithmicError object.
Definition: mean_squared_logarithmic_error_impl.hpp:23
void Backward(const PredictionType &prediction, const TargetType &target, LossType &loss)
Ordinary feed backward pass of a neural network.
Definition: mean_squared_logarithmic_error_impl.hpp:41