Attention

The vector search and clustering algorithms in RAFT are being migrated to a new library dedicated to vector search called cuVS. We will continue to support the vector search algorithms in RAFT during this move, but will no longer update them after the RAPIDS 24.06 (June) release. We plan to complete the migration by RAPIDS 24.08 (August) release.

Classification Model Scoring#

Accuracy#

#include <raft/stats/accuracy.cuh>

namespace raft::stats

template<typename value_t, typename idx_t>
float accuracy(raft::resources const &handle, raft::device_vector_view<const value_t, idx_t> predictions, raft::device_vector_view<const value_t, idx_t> ref_predictions)#

Compute accuracy of predictions. Useful for classification.

Template Parameters:
  • value_t – data type for predictions (e.g., int for classification)

  • idx_t – Index type of matrix extent.

Parameters:
  • handle[in] the raft handle.

  • predictions[in] array of predictions (GPU pointer).

  • ref_predictions[in] array of reference (ground-truth) predictions (GPU pointer).

Returns:

: Accuracy score in [0, 1]; higher is better.