hinge_embedding_loss.hpp
Go to the documentation of this file.
1 
15 #ifndef MLPACK_METHODS_ANN_LOSS_FUNCTION_HINGE_EMBEDDING_LOSS_HPP
16 #define MLPACK_METHODS_ANN_LOSS_FUNCTION_HINGE_EMBEDDING_LOSS_HPP
17 
18 #include <mlpack/prereqs.hpp>
19 
20 namespace mlpack {
21 namespace ann {
22 
32 template <
33  typename InputDataType = arma::mat,
34  typename OutputDataType = arma::mat
35 >
37 {
38  public:
43 
51  template<typename PredictionType, typename TargetType>
52  typename PredictionType::elem_type Forward(const PredictionType& prediction,
53  const TargetType& target);
54 
63  template<typename PredictionType, typename TargetType, typename LossType>
64  void Backward(const PredictionType& prediction,
65  const TargetType& target,
66  LossType& loss);
67 
69  OutputDataType& OutputParameter() const { return outputParameter; }
71  OutputDataType& OutputParameter() { return outputParameter; }
72 
76  template<typename Archive>
77  void serialize(Archive& ar, const uint32_t /* version */);
78 
79  private:
81  OutputDataType outputParameter;
82 }; // class HingeEmbeddingLoss
83 
84 } // namespace ann
85 } // namespace mlpack
86 
87 // include implementation
88 #include "hinge_embedding_loss_impl.hpp"
89 
90 #endif
Linear algebra utility functions, generally performed on matrices or vectors.
The core includes that mlpack expects; standard C++ includes and Armadillo.
void serialize(Archive &ar, const uint32_t)
Serialize the loss function.
void Backward(const PredictionType &prediction, const TargetType &target, LossType &loss)
Ordinary feed backward pass of a neural network.
PredictionType::elem_type Forward(const PredictionType &prediction, const TargetType &target)
Computes the Hinge Embedding loss function.
OutputDataType & OutputParameter() const
Get the output parameter.
OutputDataType & OutputParameter()
Modify the output parameter.
The Hinge Embedding loss function is often used to compute the loss between y_true and y_pred...
HingeEmbeddingLoss()
Create the Hinge Embedding object.