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 
50  template<typename InputType, typename TargetType>
51  typename InputType::elem_type Forward(const InputType& input,
52  const TargetType& target);
53 
61  template<typename InputType, typename TargetType, typename OutputType>
62  void Backward(const InputType& input,
63  const TargetType& target,
64  OutputType& output);
65 
67  OutputDataType& OutputParameter() const { return outputParameter; }
69  OutputDataType& OutputParameter() { return outputParameter; }
70 
74  template<typename Archive>
75  void serialize(Archive& ar, const unsigned int /* version */);
76 
77  private:
79  OutputDataType outputParameter;
80 }; // class HingeEmbeddingLoss
81 
82 } // namespace ann
83 } // namespace mlpack
84 
85 // include implementation
86 #include "hinge_embedding_loss_impl.hpp"
87 
88 #endif
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: add_to_po.hpp:21
The core includes that mlpack expects; standard C++ includes and Armadillo.
void Backward(const InputType &input, const TargetType &target, OutputType &output)
Ordinary feed backward pass of a neural network.
void serialize(Archive &ar, const unsigned int)
Serialize the loss function.
OutputDataType & OutputParameter() const
Get the output parameter.
OutputDataType & OutputParameter()
Modify the output parameter.
InputType::elem_type Forward(const InputType &input, const TargetType &target)
Computes the Hinge Embedding loss function.
The Hinge Embedding loss function is often used to compute the loss between y_true and y_pred...
HingeEmbeddingLoss()
Create the Hinge Embedding object.