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.