13 #ifndef MLPACK_METHODS_NCA_NCA_SOFTMAX_ERROR_FUNCTION_HPP
14 #define MLPACK_METHODS_NCA_NCA_SOFTMAX_ERROR_FUNCTION_HPP
41 template<
typename MetricType = metric::SquaredEucl
ideanDistance>
56 const arma::Row<size_t>& labels,
57 MetricType metric = MetricType());
66 double Evaluate(
const arma::mat& covariance);
78 double Evaluate(
const arma::mat& covariance,
const size_t i);
88 void Gradient(
const arma::mat& covariance, arma::mat& gradient);
101 void Gradient(
const arma::mat& covariance,
103 arma::mat& gradient);
118 const arma::mat& dataset;
120 const arma::Row<size_t>& labels;
126 arma::mat lastCoordinates;
128 arma::mat stretchedDataset;
133 arma::vec denominators;
151 void Precalculate(
const arma::mat& coordinates);
158 #include "nca_softmax_error_function_impl.hpp"
The "softmax" stochastic neighbor assignment probability function.
The core includes that mlpack expects; standard C++ includes and Armadillo.
size_t NumFunctions() const
Get the number of functions the objective function can be decomposed into.
double Evaluate(const arma::mat &covariance)
Evaluate the softmax function for the given covariance matrix.
const arma::mat GetInitialPoint() const
Get the initial point.
SoftmaxErrorFunction(const arma::mat &dataset, const arma::Row< size_t > &labels, MetricType metric=MetricType())
Initialize with the given kernel; useful when the kernel has some state to store, which is set elsewh...
void Gradient(const arma::mat &covariance, arma::mat &gradient)
Evaluate the gradient of the softmax function for the given covariance matrix.