dice_loss.hpp
Go to the documentation of this file.
1 
12 #ifndef MLPACK_METHODS_ANN_LOSS_FUNCTIONS_DICE_LOSS_HPP
13 #define MLPACK_METHODS_ANN_LOSS_FUNCTIONS_DICE_LOSS_HPP
14 
15 #include <mlpack/prereqs.hpp>
16 
17 namespace mlpack {
18 namespace ann {
19 
46 template <
47  typename InputDataType = arma::mat,
48  typename OutputDataType = arma::mat
49 >
50 class DiceLoss
51 {
52  public:
58  DiceLoss(const double smooth = 1);
59 
66  template<typename InputType, typename TargetType>
67  typename InputType::elem_type Forward(const InputType& input,
68  const TargetType& target);
69 
77  template<typename InputType, typename TargetType, typename OutputType>
78  void Backward(const InputType& input,
79  const TargetType& target,
80  OutputType& output);
81 
83  OutputDataType& OutputParameter() const { return outputParameter; }
85  OutputDataType& OutputParameter() { return outputParameter; }
86 
88  double Smooth() const { return smooth; }
90  double& Smooth() { return smooth; }
91 
95  template<typename Archive>
96  void serialize(Archive& ar, const unsigned int /* version */);
97 
98  private:
100  OutputDataType outputParameter;
101 
103  double smooth;
104 }; // class DiceLoss
105 
106 } // namespace ann
107 } // namespace mlpack
108 
109 // Include implementation.
110 #include "dice_loss_impl.hpp"
111 
112 #endif
The dice loss performance function measures the network&#39;s performance according to the dice coefficie...
Definition: dice_loss.hpp:50
Linear algebra utility functions, generally performed on matrices or vectors.
The core includes that mlpack expects; standard C++ includes and Armadillo.
double & Smooth()
Modify the smooth.
Definition: dice_loss.hpp:90
OutputDataType & OutputParameter() const
Get the output parameter.
Definition: dice_loss.hpp:83
void serialize(Archive &ar, const unsigned int)
Serialize the layer.
void Backward(const InputType &input, const TargetType &target, OutputType &output)
Ordinary feed backward pass of a neural network.
double Smooth() const
Get the smooth.
Definition: dice_loss.hpp:88
DiceLoss(const double smooth=1)
Create the DiceLoss object.
InputType::elem_type Forward(const InputType &input, const TargetType &target)
Computes the dice loss function.
OutputDataType & OutputParameter()
Modify the output parameter.
Definition: dice_loss.hpp:85