From 22d678e501507c9f60326cac7bc36e670ca4e44f Mon Sep 17 00:00:00 2001 From: conradsnicta Date: Fri, 22 Nov 2024 06:12:25 +0100 Subject: [PATCH] update to use .index_max() --- src/mlpack/methods/perceptron/perceptron_impl.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mlpack/methods/perceptron/perceptron_impl.hpp b/src/mlpack/methods/perceptron/perceptron_impl.hpp index c03533889cb..021ef656c92 100644 --- a/src/mlpack/methods/perceptron/perceptron_impl.hpp +++ b/src/mlpack/methods/perceptron/perceptron_impl.hpp @@ -243,8 +243,8 @@ void Perceptron< // Multiply for each variable and check whether the current weight vector // correctly classifies this. tempLabelMat = weights.t() * data.col(j) + biases; - - tempLabelMat.max(maxIndexRow, maxIndexCol); + + maxIndexRow = arma::ind2sub(arma::size(tempLabelMat), tempLabelMat.index_max())(0); // Check whether prediction is correct. if (maxIndexRow != labels(0, j)) @@ -289,7 +289,7 @@ size_t Perceptron::Classify( arma::uword maxIndex = 0; tempLabelVec = weights.t() * point + biases; - tempLabelVec.max(maxIndex); + maxIndex = tempLabelVec.index_max(); return size_t(maxIndex); } @@ -322,7 +322,7 @@ void Perceptron::Classify( for (size_t i = 0; i < test.n_cols; ++i) { tempLabelMat = weights.t() * test.col(i) + biases; - tempLabelMat.max(maxIndex); + maxIndex = tempLabelMat.index_max(); predictedLabels(i) = maxIndex; } }