[mlpack] 303/324: Simplify a matrix calculation.
Barak A. Pearlmutter
barak+git at cs.nuim.ie
Sun Aug 17 08:22:20 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 6e75b3caa364ddf6851440baec07267b6d11afc0
Author: rcurtin <rcurtin at 9d5b8971-822b-0410-80eb-d18c1038ef23>
Date: Thu Aug 7 15:42:44 2014 +0000
Simplify a matrix calculation.
git-svn-id: http://svn.cc.gatech.edu/fastlab/mlpack/trunk@16987 9d5b8971-822b-0410-80eb-d18c1038ef23
---
src/mlpack/methods/adaboost/adaboost_impl.hpp | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/src/mlpack/methods/adaboost/adaboost_impl.hpp b/src/mlpack/methods/adaboost/adaboost_impl.hpp
index 0f0461f..d420880 100644
--- a/src/mlpack/methods/adaboost/adaboost_impl.hpp
+++ b/src/mlpack/methods/adaboost/adaboost_impl.hpp
@@ -108,15 +108,7 @@ Adaboost<MatType, WeakLearner>::Adaboost(
// Now, start calculation of alpha(t) using ht
- // begin calculation of rt
-
- for (j = 0; j < ht.n_rows; j++)
- {
- for (k = 0; k < ht.n_cols; k++)
- rt += (D(j, k) * yt(j, k) * ht(j, k));
- }
- // end calculation of rt
- // std::cout<<"Value of rt is: "<<rt<<"\n";
+ rt += arma::accu(D % yt % ht);
if (i > 0)
{
@@ -180,9 +172,9 @@ void Adaboost<MatType, WeakLearner>::BuildClassificationMatrix(
{
int i, j;
- for (i = 0;i < t.n_rows; i++)
+ for (i = 0; i < t.n_rows; i++)
{
- for (j = 0;j < t.n_cols; j++)
+ for (j = 0; j < t.n_cols; j++)
{
if (j == l(i))
t(i, j) = 1.0;
--
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