13 #ifndef MLPACK_CORE_CV_METRICS_FACILITIES_HPP
14 #define MLPACK_CORE_CV_METRICS_FACILITIES_HPP
30 template<
typename DataType>
32 const arma::Row<size_t>& labels,
35 if (data.n_cols != labels.n_elem)
37 std::ostringstream oss;
38 oss << callerDescription <<
": number of points (" << data.n_cols <<
") "
39 <<
"does not match number of labels (" << labels.n_elem <<
")!"
41 throw std::invalid_argument(oss.str());
51 template<
typename DataType,
typename Metric>
55 DataType distances = DataType(data.n_cols, data.n_cols, arma::fill::none);
56 for (
size_t i = 0; i < data.n_cols; i++)
58 for (
size_t j = 0; j < i; j++)
60 distances(i, j) = metric.Evaluate(data.col(i), data.col(j));
61 distances(j, i) = distances(i, j);
64 distances.diag().zeros();
void AssertSizes(const DataType &data, const arma::Row< size_t > &labels, const std::string &callerDescription)
Assert there is the same number of the given data points and labels.
Include all of the base components required to write mlpack methods, and the main mlpack Doxygen docu...
DataType PairwiseDistances(const DataType &data, const Metric &metric)
Pairwise distance of the given data.
src mlpack core util version hpp VERSION_HPP_CONTENTS string(REGEX REPLACE".*#define MLPACK_VERSION_MAJOR ([0-9]+).*""\\1"MLPACK_VERSION_MAJOR"${VERSION_HPP_CONTENTS}") string(REGEX REPLACE".* MLPACK_VERSION_MINOR "$