12 #ifndef MLPACK_METHODS_LMNN_LMNN_HPP 13 #define MLPACK_METHODS_LMNN_LMNN_HPP 17 #include <ensmallen.hpp> 53 template<
typename MetricType = metric::SquaredEuclideanDistance,
54 typename OptimizerType = ens::AMSGrad>
68 LMNN(
const arma::mat& dataset,
69 const arma::Row<size_t>& labels,
71 const MetricType metric = MetricType());
85 template<
typename... CallbackTypes>
86 void LearnDistance(arma::mat& outputMatrix, CallbackTypes&&... callbacks);
90 const arma::mat&
Dataset()
const {
return dataset; }
93 const arma::Row<size_t>&
Labels()
const {
return labels; }
101 const size_t&
Range()
const {
return range; }
106 const size_t&
K()
const {
return k; }
108 size_t K() {
return k; }
111 const OptimizerType&
Optimizer()
const {
return optimizer; }
112 OptimizerType&
Optimizer() {
return optimizer; }
116 const arma::mat& dataset;
119 const arma::Row<size_t>& labels;
125 double regularization;
134 OptimizerType optimizer;
void LearnDistance(arma::mat &outputMatrix, CallbackTypes &&... callbacks)
Perform Large Margin Nearest Neighbors metric learning.
Definition: lmnn_impl.hpp:40
const arma::mat & Dataset() const
Get the dataset reference.
Definition: lmnn.hpp:90
double & Regularization()
Modify the regularization value.
Definition: lmnn.hpp:98
size_t & Range()
Modify the range value.
Definition: lmnn.hpp:103
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
The core includes that mlpack expects; standard C++ includes and Armadillo.
const double & Regularization() const
Access the regularization value.
Definition: lmnn.hpp:96
const size_t & K() const
Access the value of k.
Definition: lmnn.hpp:106
LMNN(const arma::mat &dataset, const arma::Row< size_t > &labels, const size_t k, const MetricType metric=MetricType())
Initialize the LMNN object, passing a dataset (distance metric is learned using this dataset) and lab...
Definition: lmnn_impl.hpp:26
const size_t & Range() const
Access the range value.
Definition: lmnn.hpp:101
An implementation of Large Margin nearest neighbor metric learning technique.
Definition: lmnn.hpp:55
const arma::Row< size_t > & Labels() const
Get the labels reference.
Definition: lmnn.hpp:93
size_t K()
Modify the value of k.
Definition: lmnn.hpp:108
const OptimizerType & Optimizer() const
Get the optimizer.
Definition: lmnn.hpp:111