Recall Computation

Documentation for computing the k recall at n metric.

template<typename Groundtruth, typename Results>
double k_recall_at_n(const Groundtruth &groundtruth, const Results &results, size_t k = 0, size_t n = 0)

Compute the k-recall@n for results with respect to groundtruth

Computes and returns the average of the k actual nearest neighbors found in the groundtruth with the n top entries in results.

If the parameters k and n are left off, this defaults to computing the n-recall@n where n == results.dimensions().

Preconditions:

  • groundtruth.size() == results.size(). Same number of groundtruth elements as result elements.

  • k <= groundtruth.dimensions(). If k == 0, then results.dimensions() <= groundtruth.dimensions().

  • n <= results.dimensions().

  • k <= n.

Parameters:
  • groundtruth – The groundtruth of nearest neighbors.

  • results – The actual computed results.

  • k – The number of groundtruth neighbors to consider (optional). Defaults to results.dimensions().

  • n – The number of results to consider (optional). Defaults to results.dimensions().

Returns:

The average k-recall@n for all entries pairwise matchings in groundtruth and results.

Argument Conversion

template<data::ImmutableMemoryDataset Data>
const Data &recall_convert(const Data &x)

Placeholder for conversion to a svs::data::ImmutableMemoryDataset.

Classes already implementing svs::data::ImmutableMemoryDataset are passed through by default unless a more specialized overload exists.

The element types of the values inside the dataset must be integers. Otherwise, a compile-time exception will be thrown.

template<std::integral T, typename Dims, typename Base>
data::ConstSimpleDataView<T> recall_convert(const DenseArray<T, Dims, Base> &x)

Create a data::ConstSimpleDataView aliasing the contents of matrix x.

Parameters:

x – The matrix to alias.

Returns:

A data::ConstSimpleDataView aliasing the memory owned by x.

template<std::integral Idx, template<typename> typename Array>
data::ConstSimpleDataView<Idx> recall_convert(const QueryResultImpl<Idx, Array> &x)

Extract the ids in the query result as a data::ConstSimpleDataView.

Parameters:

x – The query result to view.