An implementation of Large Margin nearest neighbor metric learning technique. More...
Public Member Functions  
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 labels. More...  
const arma::mat &  Dataset () const 
Get the dataset reference. More...  
const size_t &  K () const 
Access the value of k. More...  
size_t  K () 
Modify the value of k. More...  
const arma::Row< size_t > &  Labels () const 
Get the labels reference. More...  
void  LearnDistance (arma::mat &outputMatrix) 
Perform Large Margin Nearest Neighbors metric learning. More...  
const OptimizerType &  Optimizer () const 
Get the optimizer. More...  
OptimizerType &  Optimizer () 
const size_t &  Range () const 
Access the range value. More...  
size_t &  Range () 
Modify the range value. More...  
const double &  Regularization () const 
Access the regularization value. More...  
double &  Regularization () 
Modify the regularization value. More...  
An implementation of Large Margin nearest neighbor metric learning technique.
The method seeks to improve clustering & classification algorithms on a dataset by transforming the dataset representation in a more convenient form for them. It introduces the concept of target neighbors and impostors, focusing on the idea that the distance between impostors and the perimeters established by target neighbors should be large and that between target neighbors and data point should be small. It requires the knowledge of target neighbors beforehand. Moreover, target neighbors once initialized remain same.
For more details, see the following published paper:
MetricType  The type of metric to use for computation. 
OptimizerType  Optimizer to use for developing distance. 
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 labels.
Initialization will copy both dataset and labels matrices to internal copies.
dataset  Input dataset. 
labels  Input dataset labels. 
k  Number of targets to consider. 
metric  Type of metric used for computation. 

inline 

inline 
void LearnDistance  (  arma::mat &  outputMatrix  ) 
Perform Large Margin Nearest Neighbors metric learning.
The output distance matrix is written into the passed reference. If the LearnDistance() is called with an outputMatrix with correct dimensions, then that matrix will be used as the starting point for optimization.
outputMatrix  Covariance matrix of Mahalanobis distance. 

inline 

inline 

inline 

inline 