[mlpack] 161/324: Don't use arma::unique() because it's slow.

Barak A. Pearlmutter barak+git at cs.nuim.ie
Sun Aug 17 08:22:06 UTC 2014


This is an automated email from the git hooks/post-receive script.

bap pushed a commit to branch svn-trunk
in repository mlpack.

commit c7ef54831a409feeacdf998411bd98e3ebb32445
Author: rcurtin <rcurtin at 9d5b8971-822b-0410-80eb-d18c1038ef23>
Date:   Wed Jul 9 19:55:15 2014 +0000

    Don't use arma::unique() because it's slow.
    
    
    git-svn-id: http://svn.cc.gatech.edu/fastlab/mlpack/trunk@16800 9d5b8971-822b-0410-80eb-d18c1038ef23
---
 src/mlpack/methods/perceptron/perceptron_impl.hpp | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/mlpack/methods/perceptron/perceptron_impl.hpp b/src/mlpack/methods/perceptron/perceptron_impl.hpp
index 08b03c6..531b143 100644
--- a/src/mlpack/methods/perceptron/perceptron_impl.hpp
+++ b/src/mlpack/methods/perceptron/perceptron_impl.hpp
@@ -33,10 +33,8 @@ Perceptron<LearnPolicy, WeightInitializationPolicy, MatType>::Perceptron(
     const arma::Row<size_t>& labels,
     int iterations)
 {
-  arma::Row<size_t> uniqueLabels = arma::unique(labels);
-
   WeightInitializationPolicy WIP;
-  WIP.Initialize(weightVectors, uniqueLabels.n_elem, data.n_rows + 1);
+  WIP.Initialize(weightVectors, arma::max(labels) + 1, data.n_rows + 1);
 
   // Start training.
   classLabels = labels;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/mlpack.git



More information about the debian-science-commits mailing list