23 #ifndef __MLPACK_METHODS_NCA_NCA_SOFTMAX_ERROR_FUNCTION_HPP
24 #define __MLPACK_METHODS_NCA_NCA_SOFTMAX_ERROR_FUNCTION_HPP
51 template<
typename MetricType = metric::SquaredEucl
ideanDistance>
66 const arma::Col<size_t>&
labels,
67 MetricType
metric = MetricType());
76 double Evaluate(
const arma::mat& covariance);
88 double Evaluate(
const arma::mat& covariance,
const size_t i);
98 void Gradient(
const arma::mat& covariance, arma::mat& gradient);
111 void Gradient(
const arma::mat& covariance,
113 arma::mat& gradient);
171 #include "nca_softmax_error_function_impl.hpp"
const arma::mat & dataset
The dataset.
The "softmax" stochastic neighbor assignment probability function.
arma::vec denominators
Holds denominators for calculation of p_ij, for the non-separable Evaluate() and Gradient().
const arma::mat GetInitialPoint() const
Get the initial point.
size_t NumFunctions() const
Get the number of functions the objective function can be decomposed into.
void Gradient(const arma::mat &covariance, arma::mat &gradient)
Evaluate the gradient of the softmax function for the given covariance matrix.
SoftmaxErrorFunction(const arma::mat &dataset, const arma::Col< size_t > &labels, MetricType metric=MetricType())
Initialize with the given kernel; useful when the kernel has some state to store, which is set elsewh...
bool precalculated
False if nothing has ever been precalculated (only at construction time).
double Evaluate(const arma::mat &covariance)
Evaluate the softmax function for the given covariance matrix.
std::string ToString() const
arma::vec p
Holds calculated p_i, for the non-separable Evaluate() and Gradient().
MetricType metric
The instantiated metric.
const arma::Col< size_t > & labels
Labels for each point in the dataset.
void Precalculate(const arma::mat &coordinates)
Precalculate the denominators and numerators that will make up the p_ij, but only if the coordinates ...
arma::mat lastCoordinates
Last coordinates. Used for the non-separable Evaluate() and Gradient().
arma::mat stretchedDataset
Stretched dataset. Kept internal to avoid memory reallocations.