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
forresults
with respect togroundtruth
Computes and returns the average of the
k
actual nearest neighbors found in the groundtruth with then
top entries inresults
.If the parameters
k
andn
are left off, this defaults to computing then-recall@n
wheren == results.dimensions()
.Preconditions:
groundtruth.size() == results.size()
. Same number of groundtruth elements as result elements.k <= groundtruth.dimensions()
. Ifk == 0
, thenresults.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 ingroundtruth
andresults
.
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> requires (std::tuple_size_v< Dims >==2) data
Create a
data::ConstSimpleDataView
aliasing the contents of matrixx
.- Parameters:
x – The matrix to alias.
- Returns:
A
data::ConstSimpleDataView
aliasing the memory owned byx
.