Interface for generating distance based constraints on a given dataset, provided corresponding true labels and a quantity parameter (k) are specified. More...
Public Types | |
typedef neighbor::NeighborSearch< neighbor::NearestNeighborSort, MetricType > | KNN |
Convenience typedef. More... | |
Public Member Functions | |
Constraints (const arma::mat &dataset, const arma::Row< size_t > &labels, const size_t k) | |
Constructor for creating a Constraints instance. More... | |
void | Impostors (arma::Mat< size_t > &outputMatrix, const arma::mat &dataset, const arma::Row< size_t > &labels, const arma::vec &norms) |
Calculates k differently labeled nearest neighbors for each datapoint and writes them back to passed matrix. More... | |
void | Impostors (arma::Mat< size_t > &outputNeighbors, arma::mat &outputDistance, const arma::mat &dataset, const arma::Row< size_t > &labels, const arma::vec &norms) |
Calculates k differently labeled nearest neighbors & distances to impostors for each datapoint and writes them back to passed matrices. More... | |
void | Impostors (arma::Mat< size_t > &outputMatrix, const arma::mat &dataset, const arma::Row< size_t > &labels, const arma::vec &norms, const size_t begin, const size_t batchSize) |
Calculates k differently labeled nearest neighbors for a batch of dataset and writes them back to passed matrix. More... | |
void | Impostors (arma::Mat< size_t > &outputNeighbors, arma::mat &outputDistance, const arma::mat &dataset, const arma::Row< size_t > &labels, const arma::vec &norms, const size_t begin, const size_t batchSize) |
Calculates k differently labeled nearest neighbors & distances to impostors for a batch of dataset and writes them back to passed matrices. More... | |
void | Impostors (arma::Mat< size_t > &outputNeighbors, arma::mat &outputDistance, const arma::mat &dataset, const arma::Row< size_t > &labels, const arma::vec &norms, const arma::uvec &points, const size_t numPoints) |
Calculates k differently labeled nearest neighbors & distances to impostors for some points of dataset and writes them back to passed matrices. More... | |
const size_t & | K () const |
Get the number of target neighbors (k). More... | |
size_t & | K () |
Modify the number of target neighbors (k). More... | |
const bool & | PreCalulated () const |
Access the boolean value of precalculated. More... | |
bool & | PreCalulated () |
Modify the value of precalculated. More... | |
void | TargetNeighbors (arma::Mat< size_t > &outputMatrix, const arma::mat &dataset, const arma::Row< size_t > &labels, const arma::vec &norms) |
Calculates k similar labeled nearest neighbors and stores them into the passed matrix. More... | |
void | TargetNeighbors (arma::Mat< size_t > &outputMatrix, const arma::mat &dataset, const arma::Row< size_t > &labels, const arma::vec &norms, const size_t begin, const size_t batchSize) |
Calculates k similar labeled nearest neighbors for a batch of dataset and stores them into the passed matrix. More... | |
void | Triplets (arma::Mat< size_t > &outputMatrix, const arma::mat &dataset, const arma::Row< size_t > &labels, const arma::vec &norms) |
Generate triplets {i, j, l} for each datapoint i and writes back generated triplets to matrix passed. More... | |
Interface for generating distance based constraints on a given dataset, provided corresponding true labels and a quantity parameter (k) are specified.
Class provides TargetNeighbors() (Used for calculating target neighbors of each data point), Impostors() (used for calculating impostors of each data point) and Triplets() (Generates sets of {dataset, target neighbors, impostors} tripltets.)
Definition at line 31 of file constraints.hpp.
typedef neighbor::NeighborSearch<neighbor::NearestNeighborSort, MetricType> KNN |
Convenience typedef.
Definition at line 36 of file constraints.hpp.
Constraints | ( | const arma::mat & | dataset, |
const arma::Row< size_t > & | labels, | ||
const size_t | k | ||
) |
Constructor for creating a Constraints instance.
dataset | Input dataset. |
labels | Input dataset labels. |
k | Number of target neighbors, impostors & triplets. |
void Impostors | ( | arma::Mat< size_t > & | outputMatrix, |
const arma::mat & | dataset, | ||
const arma::Row< size_t > & | labels, | ||
const arma::vec & | norms | ||
) |
Calculates k differently labeled nearest neighbors for each datapoint and writes them back to passed matrix.
outputMatrix | Coordinates matrix to store impostors. |
dataset | Input dataset. |
labels | Input dataset labels. |
norms | Input dataset norms. |
void Impostors | ( | arma::Mat< size_t > & | outputNeighbors, |
arma::mat & | outputDistance, | ||
const arma::mat & | dataset, | ||
const arma::Row< size_t > & | labels, | ||
const arma::vec & | norms | ||
) |
Calculates k differently labeled nearest neighbors & distances to impostors for each datapoint and writes them back to passed matrices.
outputNeighbors | Coordinates matrix to store impostors. |
outputDistance | matrix to store distance. |
dataset | Input dataset. |
labels | Input dataset labels. |
norms | Input dataset norms. |
void Impostors | ( | arma::Mat< size_t > & | outputMatrix, |
const arma::mat & | dataset, | ||
const arma::Row< size_t > & | labels, | ||
const arma::vec & | norms, | ||
const size_t | begin, | ||
const size_t | batchSize | ||
) |
Calculates k differently labeled nearest neighbors for a batch of dataset and writes them back to passed matrix.
outputMatrix | Coordinates matrix to store impostors. |
dataset | Input dataset. |
labels | Input dataset labels. |
norms | Input dataset norms. |
begin | Index of the initial point of dataset. |
batchSize | Number of data points to use. |
void Impostors | ( | arma::Mat< size_t > & | outputNeighbors, |
arma::mat & | outputDistance, | ||
const arma::mat & | dataset, | ||
const arma::Row< size_t > & | labels, | ||
const arma::vec & | norms, | ||
const size_t | begin, | ||
const size_t | batchSize | ||
) |
Calculates k differently labeled nearest neighbors & distances to impostors for a batch of dataset and writes them back to passed matrices.
outputNeighbors | Coordinates matrix to store impostors. |
outputDistance | matrix to store distance. |
dataset | Input dataset. |
labels | Input dataset labels. |
norms | Input dataset norms. |
begin | Index of the initial point of dataset. |
batchSize | Number of data points to use. |
void Impostors | ( | arma::Mat< size_t > & | outputNeighbors, |
arma::mat & | outputDistance, | ||
const arma::mat & | dataset, | ||
const arma::Row< size_t > & | labels, | ||
const arma::vec & | norms, | ||
const arma::uvec & | points, | ||
const size_t | numPoints | ||
) |
Calculates k differently labeled nearest neighbors & distances to impostors for some points of dataset and writes them back to passed matrices.
outputNeighbors | Coordinates matrix to store impostors. |
outputDistance | matrix to store distance. |
dataset | Input dataset. |
labels | Input dataset labels. |
norms | Input dataset norms. |
points | Indices of data points to calculate impostors on. |
numPoints | Number of points to actually calculate impostors on. |
|
inline |
Get the number of target neighbors (k).
Definition at line 185 of file constraints.hpp.
|
inline |
Modify the number of target neighbors (k).
Definition at line 187 of file constraints.hpp.
|
inline |
Access the boolean value of precalculated.
Definition at line 190 of file constraints.hpp.
|
inline |
Modify the value of precalculated.
Definition at line 192 of file constraints.hpp.
void TargetNeighbors | ( | arma::Mat< size_t > & | outputMatrix, |
const arma::mat & | dataset, | ||
const arma::Row< size_t > & | labels, | ||
const arma::vec & | norms | ||
) |
Calculates k similar labeled nearest neighbors and stores them into the passed matrix.
outputMatrix | Coordinates matrix to store target neighbors. |
dataset | Input dataset. |
labels | Input dataset labels. |
norms | Input dataset norms. |
void TargetNeighbors | ( | arma::Mat< size_t > & | outputMatrix, |
const arma::mat & | dataset, | ||
const arma::Row< size_t > & | labels, | ||
const arma::vec & | norms, | ||
const size_t | begin, | ||
const size_t | batchSize | ||
) |
Calculates k similar labeled nearest neighbors for a batch of dataset and stores them into the passed matrix.
outputMatrix | Coordinates matrix to store target neighbors. |
dataset | Input dataset. |
labels | Input dataset labels. |
norms | Input dataset norms. |
begin | Index of the initial point of dataset. |
batchSize | Number of data points to use. |
void Triplets | ( | arma::Mat< size_t > & | outputMatrix, |
const arma::mat & | dataset, | ||
const arma::Row< size_t > & | labels, | ||
const arma::vec & | norms | ||
) |
Generate triplets {i, j, l} for each datapoint i and writes back generated triplets to matrix passed.
outputMatrix | Coordinates matrix to store triplets. |
dataset | Input dataset. |
labels | Input dataset labels. |
norms | Input dataset norms. |