From 59ca9428c6955a18fbfbcdebb2769b544b67d337 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Sat, 2 Apr 2022 18:16:28 -0400 Subject: [PATCH] Add standardized comment about MatType. --- src/mlpack/methods/ann/layer/add.hpp | 3 ++- src/mlpack/methods/ann/layer/alpha_dropout.hpp | 6 ++---- src/mlpack/methods/ann/layer/concatenate.hpp | 6 ++---- src/mlpack/methods/ann/layer/convolution.hpp | 6 ++---- src/mlpack/methods/ann/layer/dropconnect.hpp | 7 ++----- src/mlpack/methods/ann/layer/dropout.hpp | 7 ++----- src/mlpack/methods/ann/layer/layer.hpp | 8 ++------ src/mlpack/methods/ann/layer/leaky_relu.hpp | 7 ++----- src/mlpack/methods/ann/layer/linear.hpp | 7 ++----- src/mlpack/methods/ann/layer/linear3d.hpp | 8 +++----- src/mlpack/methods/ann/layer/linear_no_bias.hpp | 7 ++----- src/mlpack/methods/ann/layer/log_softmax.hpp | 7 ++----- src/mlpack/methods/ann/layer/lstm.hpp | 6 ++---- src/mlpack/methods/ann/layer/max_pooling.hpp | 6 ++---- src/mlpack/methods/ann/layer/multi_layer.hpp | 3 +++ src/mlpack/methods/ann/layer/noisylinear.hpp | 7 ++----- src/mlpack/methods/ann/layer/padding.hpp | 10 ++++------ .../methods/ann/layer/radial_basis_function.hpp | 7 ++----- src/mlpack/methods/ann/layer/recurrent_layer.hpp | 10 +++++++--- .../ann/loss_functions/binary_cross_entropy_loss.hpp | 10 ++++------ .../ann/loss_functions/cosine_embedding_loss.hpp | 8 +++----- src/mlpack/methods/ann/loss_functions/dice_loss.hpp | 6 ++---- .../ann/loss_functions/earth_mover_distance.hpp | 6 ++---- src/mlpack/methods/ann/loss_functions/empty_loss.hpp | 6 ++---- .../ann/loss_functions/hinge_embedding_loss.hpp | 6 ++---- src/mlpack/methods/ann/loss_functions/hinge_loss.hpp | 6 ++---- src/mlpack/methods/ann/loss_functions/huber_loss.hpp | 6 ++---- .../methods/ann/loss_functions/kl_divergence.hpp | 6 ++---- src/mlpack/methods/ann/loss_functions/l1_loss.hpp | 6 ++---- .../methods/ann/loss_functions/log_cosh_loss.hpp | 6 ++---- .../ann/loss_functions/margin_ranking_loss.hpp | 8 +++----- .../mean_absolute_percentage_error.hpp | 6 ++---- .../methods/ann/loss_functions/mean_bias_error.hpp | 10 ++++------ .../ann/loss_functions/mean_squared_error.hpp | 7 ++----- .../mean_squared_logarithmic_error.hpp | 10 ++++------ .../loss_functions/multilabel_softmargin_loss.hpp | 12 ++++++++---- .../ann/loss_functions/negative_log_likelihood.hpp | 8 +++----- .../methods/ann/loss_functions/poisson_nll_loss.hpp | 11 ++++------- .../ann/loss_functions/reconstruction_loss.hpp | 6 ++---- .../loss_functions/sigmoid_cross_entropy_error.hpp | 6 ++---- .../methods/ann/loss_functions/soft_margin_loss.hpp | 12 ++++++++---- .../ann/loss_functions/triplet_margin_loss.hpp | 11 +++++------ .../methods/ann/loss_functions/vr_class_reward.hpp | 10 ++++------ 43 files changed, 123 insertions(+), 194 deletions(-) diff --git a/src/mlpack/methods/ann/layer/add.hpp b/src/mlpack/methods/ann/layer/add.hpp index 203354f012..0ac04f7039 100644 --- a/src/mlpack/methods/ann/layer/add.hpp +++ b/src/mlpack/methods/ann/layer/add.hpp @@ -23,7 +23,8 @@ namespace ann /** Artificial Neural Network. */ { * Implementation of the Add layer. The Add module applies a bias term to the * incoming data. * - * @tparam MatType Matrix type used as inputs, outputs, and weights. + * @tparam MatType Matrix representation to accept as input and use for + * computation. */ template class AddType : public Layer diff --git a/src/mlpack/methods/ann/layer/alpha_dropout.hpp b/src/mlpack/methods/ann/layer/alpha_dropout.hpp index 4f5b2263cd..947823db6e 100644 --- a/src/mlpack/methods/ann/layer/alpha_dropout.hpp +++ b/src/mlpack/methods/ann/layer/alpha_dropout.hpp @@ -40,10 +40,8 @@ namespace ann /** Artificial Neural Network. */ { * } * @endcode * - * @tparam MatType Type of the input data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). - * @tparam MatType Type of the output data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). + * @tparam MatType Matrix representation to accept as input and use for + * computation. */ template class AlphaDropoutType : public Layer diff --git a/src/mlpack/methods/ann/layer/concatenate.hpp b/src/mlpack/methods/ann/layer/concatenate.hpp index da13462f80..61e55a8111 100644 --- a/src/mlpack/methods/ann/layer/concatenate.hpp +++ b/src/mlpack/methods/ann/layer/concatenate.hpp @@ -27,10 +27,8 @@ namespace ann /** Artificial Neural Network. */ { * * After this layer is applied, the shape of the data will be a vector. * - * @tparam MatType Type of the input data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). - * @tparam MatType Type of the output data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). + * @tparam MatType Matrix representation to accept as input and use for + * computation. */ template class ConcatenateType : public Layer diff --git a/src/mlpack/methods/ann/layer/convolution.hpp b/src/mlpack/methods/ann/layer/convolution.hpp index 131a8d3c38..7154bfdba3 100644 --- a/src/mlpack/methods/ann/layer/convolution.hpp +++ b/src/mlpack/methods/ann/layer/convolution.hpp @@ -62,10 +62,8 @@ namespace ann /** Artificial Neural Network. */ { * @tparam ForwardConvolutionRule Convolution to perform forward process. * @tparam BackwardConvolutionRule Convolution to perform backward process. * @tparam GradientConvolutionRule Convolution to calculate gradient. - * @tparam MatType Type of the input data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). - * @tparam MatType Type of the output data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). + * @tparam MatType Matrix representation to accept as input and use for + * computation. */ template < typename ForwardConvolutionRule = NaiveConvolution, diff --git a/src/mlpack/methods/ann/layer/dropconnect.hpp b/src/mlpack/methods/ann/layer/dropconnect.hpp index 0537aa5b29..c00a2d2129 100644 --- a/src/mlpack/methods/ann/layer/dropconnect.hpp +++ b/src/mlpack/methods/ann/layer/dropconnect.hpp @@ -43,11 +43,8 @@ namespace ann /** Artificial Neural Network. */ { * } * @endcode * - * @tparam MatType The type of the layer's inputs. The layer automatically - * cast inputs to this type (Default: arma::mat). - * @tparam MatType The type of the computation which also causes the output - * to also be in this type. The type also allows the computation and weight - * type to differ from the input type (Default: arma::mat). + * @tparam MatType Matrix representation to accept as input and use for + * computation. */ template class DropConnectType : public Layer diff --git a/src/mlpack/methods/ann/layer/dropout.hpp b/src/mlpack/methods/ann/layer/dropout.hpp index e56b9f2ab0..f03250145f 100644 --- a/src/mlpack/methods/ann/layer/dropout.hpp +++ b/src/mlpack/methods/ann/layer/dropout.hpp @@ -41,11 +41,8 @@ namespace ann /** Artificial Neural Network. */ { * } * @endcode * - * @tparam MatType The type of the layer's inputs. The layer automatically - * cast inputs to this type (Default: arma::mat). - * @tparam MatType The type of the computation which also causes the output - * to also be in this type. The type also allows the computation and weight - * type to differ from the input type (Default: arma::mat). + * @tparam MatType Matrix representation to accept as input and use for + * computation. */ template class DropoutType : public Layer diff --git a/src/mlpack/methods/ann/layer/layer.hpp b/src/mlpack/methods/ann/layer/layer.hpp index 3cfd7102f3..9a89aedb2a 100644 --- a/src/mlpack/methods/ann/layer/layer.hpp +++ b/src/mlpack/methods/ann/layer/layer.hpp @@ -45,12 +45,8 @@ namespace ann { * Forward(), Backward() and Gradient(). The weights of the layers are tracked * in layer.Parameters(). * - * @tparam MatType The type of the layer's inputs. Layers automatically cast - * inputs to this type (default: arma::mat). - * @tparam MatType The type of the layer's computation which also causes the - * computations and output to also be in this type. The type also allows the - * computation and weight type to differ from the input type - * (default: arma::mat). + * @tparam MatType Matrix representation to accept as input and use for + * computation. */ template class Layer diff --git a/src/mlpack/methods/ann/layer/leaky_relu.hpp b/src/mlpack/methods/ann/layer/leaky_relu.hpp index 659e6df4c4..b275371de6 100644 --- a/src/mlpack/methods/ann/layer/leaky_relu.hpp +++ b/src/mlpack/methods/ann/layer/leaky_relu.hpp @@ -34,11 +34,8 @@ namespace ann /** Artificial Neural Network. */ { * \right. * @f} * - * @tparam MatType The type of the layer's inputs. The layer automatically - * cast inputs to this type (Default: arma::mat). - * @tparam MatType The type of the computation which also causes the output - * to also be in this type. The type also allows the computation and weight - * type to differ from the input type (Default: arma::mat). + * @tparam MatType Matrix representation to accept as input and use for + * computation. */ template class LeakyReLUType : public Layer diff --git a/src/mlpack/methods/ann/layer/linear.hpp b/src/mlpack/methods/ann/layer/linear.hpp index 7ed53a5385..eb53346e46 100644 --- a/src/mlpack/methods/ann/layer/linear.hpp +++ b/src/mlpack/methods/ann/layer/linear.hpp @@ -30,11 +30,8 @@ namespace ann /** Artificial Neural Network. */ { * must be either a vector or matrix. If the input is a matrix, then each column * is assumed to be an input sample of given batch. * - * @tparam MatType The type of the layer's inputs. The layer automatically - * cast inputs to this type (Default: arma::mat). - * @tparam MatType The type of the computation which also causes the output - * to also be in this type. The type also allows the computation and weight - * type to differ from the input type (Default: arma::mat). + * @tparam MatType Matrix representation to accept as input and use for + * computation. * @tparam RegularizerType Type of the regularizer to be used (Default no * regularizer). */ diff --git a/src/mlpack/methods/ann/layer/linear3d.hpp b/src/mlpack/methods/ann/layer/linear3d.hpp index 03bfe4c706..4ddc8e140e 100644 --- a/src/mlpack/methods/ann/layer/linear3d.hpp +++ b/src/mlpack/methods/ann/layer/linear3d.hpp @@ -29,12 +29,10 @@ namespace ann /** Artificial Neural Network. */ { * Shape of input : (inSize * nPoints, batchSize) * Shape of output : (outSize * nPoints, batchSize) * - * @tparam MatType Type of the input data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). - * @tparam MatType Type of the output data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). + * @tparam MatType Matrix representation to accept as input and use for + * computation. */ -template < +template< typename MatType = arma::mat, typename RegularizerType = NoRegularizer > diff --git a/src/mlpack/methods/ann/layer/linear_no_bias.hpp b/src/mlpack/methods/ann/layer/linear_no_bias.hpp index e3ae93e86b..00bf074d7a 100644 --- a/src/mlpack/methods/ann/layer/linear_no_bias.hpp +++ b/src/mlpack/methods/ann/layer/linear_no_bias.hpp @@ -25,11 +25,8 @@ namespace ann /** Artificial Neural Network. */ { * Implementation of the LinearNoBias class. The LinearNoBias class represents a * single layer of a neural network. * - * @tparam MatType The type of the layer's inputs. The layer automatically - * cast inputs to this type (Default: arma::mat). - * @tparam MatType The type of the computation which also causes the output - * to also be in this type. The type also allows the computation and weight - * type to differ from the input type (Default: arma::mat). + * @tparam MatType Matrix representation to accept as input and use for + * computation. * @tparam RegularizerType Type of the regularizer to be used (Default no * regularizer). */ diff --git a/src/mlpack/methods/ann/layer/log_softmax.hpp b/src/mlpack/methods/ann/layer/log_softmax.hpp index b500e08724..a93edb6183 100644 --- a/src/mlpack/methods/ann/layer/log_softmax.hpp +++ b/src/mlpack/methods/ann/layer/log_softmax.hpp @@ -26,11 +26,8 @@ namespace ann /** Artificial Neural Network. */ { * (NegativeLogLikelihoodLayer), which expects that the input contains * log-probabilities for each class. * - * @tparam MatType The type of the layer's inputs. The layer automatically - * cast inputs to this type (Default: arma::mat). - * @tparam MatType The type of the computation which also causes the output - * to also be in this type. The type also allows the computation and weight - * type to differ from the input type (Default: arma::mat). + * @tparam MatType Matrix representation to accept as input and use for + * computation. */ template class LogSoftMaxType : public Layer diff --git a/src/mlpack/methods/ann/layer/lstm.hpp b/src/mlpack/methods/ann/layer/lstm.hpp index e6676753aa..7c1ca4f632 100644 --- a/src/mlpack/methods/ann/layer/lstm.hpp +++ b/src/mlpack/methods/ann/layer/lstm.hpp @@ -52,10 +52,8 @@ namespace ann /** Artificial Neural Network. */ { * \see FastLSTM for a faster LSTM version which combines the calculation of the * input, forget, output gates and hidden state in a single step. * - * @tparam MatType Type of the input data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). - * @tparam MatType Type of the output data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). + * @tparam MatType Matrix representation to accept as input and use for + * computation. */ template class LSTMType : public RecurrentLayer diff --git a/src/mlpack/methods/ann/layer/max_pooling.hpp b/src/mlpack/methods/ann/layer/max_pooling.hpp index 72b79e67fb..75636d15be 100644 --- a/src/mlpack/methods/ann/layer/max_pooling.hpp +++ b/src/mlpack/methods/ann/layer/max_pooling.hpp @@ -52,10 +52,8 @@ class MaxPoolingRule /** * Implementation of the MaxPooling layer. * - * @tparam MatType Type of the input data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). - * @tparam MatType Type of the output data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). + * @tparam MatType Matrix representation to accept as input and use for + * computation. */ template class MaxPoolingType : public Layer diff --git a/src/mlpack/methods/ann/layer/multi_layer.hpp b/src/mlpack/methods/ann/layer/multi_layer.hpp index 3f56a7d124..0dda071024 100644 --- a/src/mlpack/methods/ann/layer/multi_layer.hpp +++ b/src/mlpack/methods/ann/layer/multi_layer.hpp @@ -25,6 +25,9 @@ namespace ann { * It's likely not very useful to use this layer directly; instead, this layer * is meant as a base class for use by other layers that must store and use * multiple layers. + * + * @tparam MatType Matrix representation to accept as input and use for + * computation. */ template class MultiLayer : public Layer diff --git a/src/mlpack/methods/ann/layer/noisylinear.hpp b/src/mlpack/methods/ann/layer/noisylinear.hpp index d536399faf..e6e8a51abc 100644 --- a/src/mlpack/methods/ann/layer/noisylinear.hpp +++ b/src/mlpack/methods/ann/layer/noisylinear.hpp @@ -24,11 +24,8 @@ namespace ann /** Artificial Neural Network. */ { * Implementation of the NoisyLinear layer class. It represents a single * layer of a neural network, with parametric noise added to its weights. * - * @tparam MatType The type of the layer's inputs. The layer automatically - * cast inputs to this type (Default: arma::mat). - * @tparam MatType The type of the computation which also causes the output - * to also be in this type. The type also allows the computation and weight - * type to differ from the input type (Default: arma::mat). + * @tparam MatType Matrix representation to accept as input and use for + * computation. */ template class NoisyLinearType : public Layer diff --git a/src/mlpack/methods/ann/layer/padding.hpp b/src/mlpack/methods/ann/layer/padding.hpp index 378112aa5a..018a28479b 100644 --- a/src/mlpack/methods/ann/layer/padding.hpp +++ b/src/mlpack/methods/ann/layer/padding.hpp @@ -19,13 +19,11 @@ namespace mlpack { namespace ann /** Artificial Neural Network. */ { /** - * Implementation of the Padding module class. The Padding module applies a bias term - * to the incoming data. + * Implementation of the Padding module class. The Padding module applies + * (zero-valued) padding on the input data. * - * @tparam MatType Type of the input data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). - * @tparam MatType Type of the output data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). + * @tparam MatType Matrix representation to accept as input and use for + * computation. */ template class PaddingType : public Layer diff --git a/src/mlpack/methods/ann/layer/radial_basis_function.hpp b/src/mlpack/methods/ann/layer/radial_basis_function.hpp index 056fc2718c..f1ec3379f1 100644 --- a/src/mlpack/methods/ann/layer/radial_basis_function.hpp +++ b/src/mlpack/methods/ann/layer/radial_basis_function.hpp @@ -21,7 +21,6 @@ namespace mlpack { namespace ann /** Artificial Neural Network. */ { - /** * Implementation of the Radial Basis Function layer. The RBFType class when use * with a non-linear activation function acts as a Radial Basis Function which @@ -38,10 +37,8 @@ namespace ann /** Artificial Neural Network. */ { * } * @endcode * - * @tparam MatType Type of the input data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). - * @tparam MatType Type of the output data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). + * @tparam MatType Matrix representation to accept as input and use for + * computation. * @tparam Activation Type of the activation function (mlpack::ann::Gaussian). */ diff --git a/src/mlpack/methods/ann/layer/recurrent_layer.hpp b/src/mlpack/methods/ann/layer/recurrent_layer.hpp index 1be5a7e17f..d925841f4a 100644 --- a/src/mlpack/methods/ann/layer/recurrent_layer.hpp +++ b/src/mlpack/methods/ann/layer/recurrent_layer.hpp @@ -15,9 +15,13 @@ namespace mlpack { namespace ann { -template< - typename MatType = arma::mat -> +/** + * TODO: comment + * + * @tparam MatType Matrix representation to accept as input and use for + * computation. + */ +template class RecurrentLayer : public Layer { public: diff --git a/src/mlpack/methods/ann/loss_functions/binary_cross_entropy_loss.hpp b/src/mlpack/methods/ann/loss_functions/binary_cross_entropy_loss.hpp index 510094ec0d..b2d8f721ac 100644 --- a/src/mlpack/methods/ann/loss_functions/binary_cross_entropy_loss.hpp +++ b/src/mlpack/methods/ann/loss_functions/binary_cross_entropy_loss.hpp @@ -18,13 +18,11 @@ namespace mlpack { namespace ann /** Artificial Neural Network. */ { /** - * The binary-cross-entropy performance function measures the - * Binary Cross Entropy between the target and the output. + * The binary-cross-entropy performance function measures the Binary Cross + * Entropy between the target and the output. * - * @tparam InputDataType Type of the input data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). - * @tparam MatType Type of the output data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). + * @tparam MatType Matrix representation to accept as input and use for + * computation. */ template class BCELossType diff --git a/src/mlpack/methods/ann/loss_functions/cosine_embedding_loss.hpp b/src/mlpack/methods/ann/loss_functions/cosine_embedding_loss.hpp index 8ef6ab7092..5a60519133 100644 --- a/src/mlpack/methods/ann/loss_functions/cosine_embedding_loss.hpp +++ b/src/mlpack/methods/ann/loss_functions/cosine_embedding_loss.hpp @@ -26,11 +26,9 @@ namespace ann /** Artificial Neural Network. */ { * f(x) = 1 - cos(x1, x2) , for y = 1 * f(x) = max(0, cos(x1, x2) - margin) , for y = -1 * @f} - * - * @tparam MatType Type of the input data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). - * @tparam MatType Type of the output data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). + * + * @tparam MatType Matrix representation to accept as input and use for + * computation. */ template class CosineEmbeddingLossType diff --git a/src/mlpack/methods/ann/loss_functions/dice_loss.hpp b/src/mlpack/methods/ann/loss_functions/dice_loss.hpp index b7fff35ae3..ad38ea1735 100644 --- a/src/mlpack/methods/ann/loss_functions/dice_loss.hpp +++ b/src/mlpack/methods/ann/loss_functions/dice_loss.hpp @@ -38,10 +38,8 @@ namespace ann /** Artificial Neural Network. */ { * } * @endcode * - * @tparam InputDataType Type of the input data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). - * @tparam MatType Type of the output data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). + * @tparam MatType Matrix representation to accept as input and use for + * computation. */ template class DiceLossType diff --git a/src/mlpack/methods/ann/loss_functions/earth_mover_distance.hpp b/src/mlpack/methods/ann/loss_functions/earth_mover_distance.hpp index 341b346650..6496133a9d 100644 --- a/src/mlpack/methods/ann/loss_functions/earth_mover_distance.hpp +++ b/src/mlpack/methods/ann/loss_functions/earth_mover_distance.hpp @@ -21,10 +21,8 @@ namespace ann /** Artificial Neural Network. */ { * The earth mover distance function measures the network's performance * according to the Kantorovich-Rubinstein duality approximation. * - * @tparam MatType Type of the input data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). - * @tparam MatType Type of the output data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). + * @tparam MatType Matrix representation to accept as input and use for + * computation. */ template class EarthMoverDistanceType diff --git a/src/mlpack/methods/ann/loss_functions/empty_loss.hpp b/src/mlpack/methods/ann/loss_functions/empty_loss.hpp index 2b63eaae77..6f2d378a99 100644 --- a/src/mlpack/methods/ann/loss_functions/empty_loss.hpp +++ b/src/mlpack/methods/ann/loss_functions/empty_loss.hpp @@ -23,10 +23,8 @@ namespace ann /** Artificial Neural Network. */ { * The empty loss does nothing, letting the user calculate the loss outside * the model. * - * @tparam InputDataType Type of the input data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). - * @tparam OutputDataType Type of the output data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). + * @tparam MatType Matrix representation to accept as input and use for + * computation. */ template class EmptyLossType diff --git a/src/mlpack/methods/ann/loss_functions/hinge_embedding_loss.hpp b/src/mlpack/methods/ann/loss_functions/hinge_embedding_loss.hpp index 3a8c941143..8eb587c45f 100644 --- a/src/mlpack/methods/ann/loss_functions/hinge_embedding_loss.hpp +++ b/src/mlpack/methods/ann/loss_functions/hinge_embedding_loss.hpp @@ -24,10 +24,8 @@ namespace ann /** Artificial Neural Network. */ { * The Hinge Embedding loss function is often used to compute the loss * between y_true and y_pred. * - * @tparam InputDataType Type of the input data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). - * @tparam OutputDataType Type of the output data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). + * @tparam MatType Matrix representation to accept as input and use for + * computation. */ template class HingeEmbeddingLossType diff --git a/src/mlpack/methods/ann/loss_functions/hinge_loss.hpp b/src/mlpack/methods/ann/loss_functions/hinge_loss.hpp index 53a67710f0..10034ae832 100644 --- a/src/mlpack/methods/ann/loss_functions/hinge_loss.hpp +++ b/src/mlpack/methods/ann/loss_functions/hinge_loss.hpp @@ -25,10 +25,8 @@ namespace ann /** Artificial Neural Network. */ { * The hinge loss \f$l(y_true, y_pred)\f$ is defined as * \f$l(y_true, y_pred) = max(0, 1 - y_true*y_pred)\f$. * - * @tparam InputDataType Type of the input data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). - * @tparam OutputDataType Type of the output data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). + * @tparam MatType Matrix representation to accept as input and use for + * computation. */ template class HingeLossType diff --git a/src/mlpack/methods/ann/loss_functions/huber_loss.hpp b/src/mlpack/methods/ann/loss_functions/huber_loss.hpp index 22f71f0d25..f15d9abeee 100644 --- a/src/mlpack/methods/ann/loss_functions/huber_loss.hpp +++ b/src/mlpack/methods/ann/loss_functions/huber_loss.hpp @@ -24,10 +24,8 @@ namespace ann /** Artificial Neural Network. */ { * and linear for large values, with equal values and slopes of the different * sections at the two points where \f$ |y - f(x)| = delta \f$. * - * @tparam MatType Type of the input data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). - * @tparam MatType Type of the output data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). + * @tparam MatType Matrix representation to accept as input and use for + * computation. */ template class HuberLossType diff --git a/src/mlpack/methods/ann/loss_functions/kl_divergence.hpp b/src/mlpack/methods/ann/loss_functions/kl_divergence.hpp index a96f58e6ca..e0ea96e299 100644 --- a/src/mlpack/methods/ann/loss_functions/kl_divergence.hpp +++ b/src/mlpack/methods/ann/loss_functions/kl_divergence.hpp @@ -33,10 +33,8 @@ namespace ann /** Artificial Neural Network. */ { * } * @endcode * - * @tparam MatType Type of the input data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). - * @tparam MatType Type of the output data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). + * @tparam MatType Matrix representation to accept as input and use for + * computation. */ template class KLDivergenceType diff --git a/src/mlpack/methods/ann/loss_functions/l1_loss.hpp b/src/mlpack/methods/ann/loss_functions/l1_loss.hpp index f094e70048..0dceac61d7 100644 --- a/src/mlpack/methods/ann/loss_functions/l1_loss.hpp +++ b/src/mlpack/methods/ann/loss_functions/l1_loss.hpp @@ -21,10 +21,8 @@ namespace ann /** Artificial Neural Network. */ { * The L1 loss is a loss function that measures the mean absolute error (MAE) * between each element in the input x and target y * - * @tparam InputDataType Type of the input data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). - * @tparam OutputDataType Type of the output data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). + * @tparam MatType Matrix representation to accept as input and use for + * computation. */ template class L1LossType diff --git a/src/mlpack/methods/ann/loss_functions/log_cosh_loss.hpp b/src/mlpack/methods/ann/loss_functions/log_cosh_loss.hpp index 462b362da5..686fe69f6d 100644 --- a/src/mlpack/methods/ann/loss_functions/log_cosh_loss.hpp +++ b/src/mlpack/methods/ann/loss_functions/log_cosh_loss.hpp @@ -23,10 +23,8 @@ namespace ann /** Artificial Neural Network. */ { * variational auto encoder. This function is the log of hyperbolic * cosine of difference between true values and predicted values. * - * @tparam InputDataType Type of the input data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). - * @tparam OutputDataType Type of the output data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). + * @tparam MatType Matrix representation to accept as input and use for + * computation. */ template class LogCoshLossType diff --git a/src/mlpack/methods/ann/loss_functions/margin_ranking_loss.hpp b/src/mlpack/methods/ann/loss_functions/margin_ranking_loss.hpp index 4617fcafbd..293ca349aa 100644 --- a/src/mlpack/methods/ann/loss_functions/margin_ranking_loss.hpp +++ b/src/mlpack/methods/ann/loss_functions/margin_ranking_loss.hpp @@ -22,11 +22,9 @@ namespace ann /** Artificial Neural Network. */ { * values of 1 or -1. If the label is 1 then the first input should be ranked * higher than the second input at a distance larger than a margin, and vice- * versa if the label is -1. - * - * @tparam InputDataType Type of the input data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). - * @tparam OutputDataType Type of the output data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). + * + * @tparam MatType Matrix representation to accept as input and use for + * computation. */ template class MarginRankingLossType diff --git a/src/mlpack/methods/ann/loss_functions/mean_absolute_percentage_error.hpp b/src/mlpack/methods/ann/loss_functions/mean_absolute_percentage_error.hpp index 23ab49bf57..b2629936c0 100644 --- a/src/mlpack/methods/ann/loss_functions/mean_absolute_percentage_error.hpp +++ b/src/mlpack/methods/ann/loss_functions/mean_absolute_percentage_error.hpp @@ -37,10 +37,8 @@ namespace ann /** Artificial Neural Network. */ { * } * @endcode * - * @tparam InputDataType Type of the input data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). - * @tparam OutputDataType Type of the output data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). + * @tparam MatType Matrix representation to accept as input and use for + * computation. */ template class MeanAbsolutePercentageErrorType diff --git a/src/mlpack/methods/ann/loss_functions/mean_bias_error.hpp b/src/mlpack/methods/ann/loss_functions/mean_bias_error.hpp index 9bc1008240..2a667be43d 100644 --- a/src/mlpack/methods/ann/loss_functions/mean_bias_error.hpp +++ b/src/mlpack/methods/ann/loss_functions/mean_bias_error.hpp @@ -18,13 +18,11 @@ namespace mlpack { namespace ann /** Artificial Neural Network. */ { /** - * The mean bias error performance function measures the network's - * performance according to the mean of errors. + * The mean bias error performance function measures the network's performance + * according to the mean of errors. * - * @tparam InputDataType Type of the input data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). - * @tparam OutputDataType Type of the output data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). + * @tparam MatType Matrix representation to accept as input and use for + * computation. */ template class MeanBiasErrorType diff --git a/src/mlpack/methods/ann/loss_functions/mean_squared_error.hpp b/src/mlpack/methods/ann/loss_functions/mean_squared_error.hpp index 1097333022..bb0c12f046 100644 --- a/src/mlpack/methods/ann/loss_functions/mean_squared_error.hpp +++ b/src/mlpack/methods/ann/loss_functions/mean_squared_error.hpp @@ -21,11 +21,8 @@ namespace ann /** Artificial Neural Network. */ { * The mean squared error performance function measures the network's * performance according to the mean of squared errors. * - * @tparam ActivationFunction Activation function used for the embedding layer. - * @tparam InputDataType Type of the input data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). - * @tparam OutputDataType Type of the output data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). + * @tparam MatType Matrix representation to accept as input and use for + * computation. */ template class MeanSquaredErrorType diff --git a/src/mlpack/methods/ann/loss_functions/mean_squared_logarithmic_error.hpp b/src/mlpack/methods/ann/loss_functions/mean_squared_logarithmic_error.hpp index cb00e6a3ee..2ed31fec72 100644 --- a/src/mlpack/methods/ann/loss_functions/mean_squared_logarithmic_error.hpp +++ b/src/mlpack/methods/ann/loss_functions/mean_squared_logarithmic_error.hpp @@ -18,13 +18,11 @@ namespace mlpack { namespace ann /** Artificial Neural Network. */ { /** - * The mean squared logarithmic error performance function measures the network's - * performance according to the mean of squared logarithmic errors. + * The mean squared logarithmic error performance function measures the + * network's performance according to the mean of squared logarithmic errors. * - * @tparam InputDataType Type of the input data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). - * @tparam OutputDataType Type of the output data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). + * @tparam MatType Matrix representation to accept as input and use for + * computation. */ template class MeanSquaredLogarithmicErrorType diff --git a/src/mlpack/methods/ann/loss_functions/multilabel_softmargin_loss.hpp b/src/mlpack/methods/ann/loss_functions/multilabel_softmargin_loss.hpp index 97aa19ae71..0d78c69f35 100644 --- a/src/mlpack/methods/ann/loss_functions/multilabel_softmargin_loss.hpp +++ b/src/mlpack/methods/ann/loss_functions/multilabel_softmargin_loss.hpp @@ -22,10 +22,14 @@ namespace mlpack { namespace ann /** Artificial Neural Network. */ { /** - * @tparam InputDataType Type of the input data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). - * @tparam OutputDataType Type of the output data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). + * The Multi-label Soft Margin Loss function. + * + * It is a criterion that optimizes a multi-label one-versus-all loss based on + * max-entropy, between input x and target y of size (N, C) where N is the + * batch size and C is the number of classes. + * + * @tparam MatType Matrix representation to accept as input and use for + * computation. */ template class MultiLabelSoftMarginLossType diff --git a/src/mlpack/methods/ann/loss_functions/negative_log_likelihood.hpp b/src/mlpack/methods/ann/loss_functions/negative_log_likelihood.hpp index 314794d58c..9ca4a537ed 100644 --- a/src/mlpack/methods/ann/loss_functions/negative_log_likelihood.hpp +++ b/src/mlpack/methods/ann/loss_functions/negative_log_likelihood.hpp @@ -20,13 +20,11 @@ namespace ann /** Artificial Neural Network. */ { /** * Implementation of the negative log likelihood layer. The negative log * likelihood layer expectes that the input contains log-probabilities for each - * class. The layer also expects a class index, in the range between 1 and the + * class. The layer also expects a class index in the range [0, numClasses - 1] * number of classes, as target when calling the Forward function. * - * @tparam MatType Type of the input data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). - * @tparam MatType Type of the output data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). + * @tparam MatType Matrix representation to accept as input and use for + * computation. */ template class NegativeLogLikelihoodType diff --git a/src/mlpack/methods/ann/loss_functions/poisson_nll_loss.hpp b/src/mlpack/methods/ann/loss_functions/poisson_nll_loss.hpp index c1d03568a6..0b6fa37cf4 100644 --- a/src/mlpack/methods/ann/loss_functions/poisson_nll_loss.hpp +++ b/src/mlpack/methods/ann/loss_functions/poisson_nll_loss.hpp @@ -20,14 +20,11 @@ namespace ann /** Artificial Neural Network. */ { /** * Implementation of the Poisson negative log likelihood loss. This loss - * function expects input for each class. It also expects a class index, - * in the range between 1 and the number of classes, as target when calling - * the Forward function. + * function expects input for each class. It also expects a class index, in the + * range [0, numClasses - 1], as target when calling the Forward function. * - * @tparam MatType Type of the input data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). - * @tparam MatType Type of the output data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). + * @tparam MatType Matrix representation to accept as input and use for + * computation. */ template class PoissonNLLLossType diff --git a/src/mlpack/methods/ann/loss_functions/reconstruction_loss.hpp b/src/mlpack/methods/ann/loss_functions/reconstruction_loss.hpp index b9c2abce90..1038f013d0 100644 --- a/src/mlpack/methods/ann/loss_functions/reconstruction_loss.hpp +++ b/src/mlpack/methods/ann/loss_functions/reconstruction_loss.hpp @@ -23,10 +23,8 @@ namespace ann /** Artificial Neural Network. */ { * performance equal to the negative log probability of the target with * the input distribution. * - * @tparam InputDataType Type of the input data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). - * @tparam OutputDataType Type of the output data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). + * @tparam MatType Matrix representation to accept as input and use for + * computation. * @tparam DistType The type of distribution parametrized by the input. */ template< diff --git a/src/mlpack/methods/ann/loss_functions/sigmoid_cross_entropy_error.hpp b/src/mlpack/methods/ann/loss_functions/sigmoid_cross_entropy_error.hpp index 0ea11fb331..8a8d4791ac 100644 --- a/src/mlpack/methods/ann/loss_functions/sigmoid_cross_entropy_error.hpp +++ b/src/mlpack/methods/ann/loss_functions/sigmoid_cross_entropy_error.hpp @@ -40,10 +40,8 @@ namespace ann /** Artificial Neural Network. */ { * } * @endcode * - * @tparam InputDataType Type of the input data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). - * @tparam OutputDataType Type of the output data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). + * @tparam MatType Matrix representation to accept as input and use for + * computation. */ template class SigmoidCrossEntropyErrorType diff --git a/src/mlpack/methods/ann/loss_functions/soft_margin_loss.hpp b/src/mlpack/methods/ann/loss_functions/soft_margin_loss.hpp index 85d273e602..2869bc3908 100644 --- a/src/mlpack/methods/ann/loss_functions/soft_margin_loss.hpp +++ b/src/mlpack/methods/ann/loss_functions/soft_margin_loss.hpp @@ -22,10 +22,14 @@ namespace mlpack { namespace ann /** Artificial Neural Network. */ { /** - * @tparam InputDataType Type of the input data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). - * @tparam OutputDataType Type of the output data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). + * The Soft Margin Loss function. + * + * It is a criterion that optimizes a two-class classification logistic loss, + * between input x and target y, both having the same shape, with the target + * containing only the values 1 or -1. + * + * @tparam MatType Matrix representation to accept as input and use for + * computation. */ template class SoftMarginLossType diff --git a/src/mlpack/methods/ann/loss_functions/triplet_margin_loss.hpp b/src/mlpack/methods/ann/loss_functions/triplet_margin_loss.hpp index 923e1becc6..eb232070d8 100644 --- a/src/mlpack/methods/ann/loss_functions/triplet_margin_loss.hpp +++ b/src/mlpack/methods/ann/loss_functions/triplet_margin_loss.hpp @@ -24,22 +24,21 @@ namespace ann /** Artificial Neural Network. */ { * of the positive (truthy) and negative (falsy) inputs. * The distance between two samples A and B is defined as square of L2 norm * of A-B. - * + * * For more information, refer the following paper. * * @code * @article{Schroff2015, * author = {Florian Schroff, Dmitry Kalenichenko, James Philbin}, - * title = {FaceNet: A Unified Embedding for Face Recognition and Clustering}, + * title = {FaceNet: A Unified Embedding for Face Recognition and + * Clustering}, * year = {2015}, * url = {https://arxiv.org/abs/1503.03832}, * } * @endcode * - * @tparam InputDataType Type of the input data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). - * @tparam OutputDataType Type of the output data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). + * @tparam MatType Matrix representation to accept as input and use for + * computation. */ template class TripletMarginLossType diff --git a/src/mlpack/methods/ann/loss_functions/vr_class_reward.hpp b/src/mlpack/methods/ann/loss_functions/vr_class_reward.hpp index d6f0242713..b681fe5154 100644 --- a/src/mlpack/methods/ann/loss_functions/vr_class_reward.hpp +++ b/src/mlpack/methods/ann/loss_functions/vr_class_reward.hpp @@ -21,13 +21,11 @@ namespace ann /** Artificial Neural Network. */ { /** * Implementation of the variance reduced classification reinforcement layer. * This layer is meant to be used in combination with the reinforce normal layer - * (ReinforceNormalLayer), which expects that an reward: - * (1 for success, 0 otherwise). + * (ReinforceNormalLayer), which expects that the reward is 1 for success, and 0 + * otherwise. * - * @tparam InputDataType Type of the input data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). - * @tparam MatType Type of the output data (arma::colvec, arma::mat, - * arma::sp_mat or arma::cube). + * @tparam MatType Matrix representation to accept as input and use for + * computation. */ template class VRClassRewardType