12 #ifndef MLPACK_METHODS_AUGMENTED_TASKS_SCORE_IMPL_HPP 13 #define MLPACK_METHODS_AUGMENTED_TASKS_SCORE_IMPL_HPP 23 template<
typename MatType>
25 arma::field<MatType> predOutputs,
29 size_t testSize = trueOutputs.n_elem;
30 if (trueOutputs.n_elem != predOutputs.n_elem)
32 std::ostringstream oss;
33 oss <<
"SequencePrecision(): number of predicted sequences (" 34 << predOutputs.n_elem <<
") should be equal to the number " 35 <<
"of ground-truth sequences (" 36 << trueOutputs.n_elem <<
")" 38 throw std::invalid_argument(oss.str());
41 for (
size_t i = 0; i < testSize; ++i)
43 arma::vec delta = arma::vectorise(arma::abs(
44 trueOutputs.at(i) - predOutputs.at(i)));
45 double maxDelta = arma::max(delta);
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
double SequencePrecision(arma::field< MatType > trueOutputs, arma::field< MatType > predOutputs, double tol=1e-4)
Function that computes the sequences precision (number of correct sequences / number of sequences) of...
Definition: score_impl.hpp:24