[mlpack] 167/324: Minor improvement. No major functionality changes
Barak A. Pearlmutter
barak+git at cs.nuim.ie
Sun Aug 17 08:22:07 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 798407148b84081a51af2200d24e9facbb7244c9
Author: saxena.udit <saxena.udit at 9d5b8971-822b-0410-80eb-d18c1038ef23>
Date: Thu Jul 10 13:49:08 2014 +0000
Minor improvement. No major functionality changes
git-svn-id: http://svn.cc.gatech.edu/fastlab/mlpack/trunk@16806 9d5b8971-822b-0410-80eb-d18c1038ef23
---
src/mlpack/methods/perceptron/perceptron_impl.hpp | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/src/mlpack/methods/perceptron/perceptron_impl.hpp b/src/mlpack/methods/perceptron/perceptron_impl.hpp
index 7244b43..bcec50f 100644
--- a/src/mlpack/methods/perceptron/perceptron_impl.hpp
+++ b/src/mlpack/methods/perceptron/perceptron_impl.hpp
@@ -49,7 +49,6 @@ Perceptron<LearnPolicy, WeightInitializationPolicy, MatType>::Perceptron(
bool converged = false;
size_t tempLabel;
arma::uword maxIndexRow, maxIndexCol;
- double maxVal;
arma::mat tempLabelMat;
LearnPolicy LP;
@@ -68,8 +67,8 @@ Perceptron<LearnPolicy, WeightInitializationPolicy, MatType>::Perceptron(
// correctly classifies this.
tempLabelMat = weightVectors * trainData.col(j);
- maxVal = tempLabelMat.max(maxIndexRow, maxIndexCol);
- maxVal *= 2;
+ tempLabelMat.max(maxIndexRow, maxIndexCol);
+
// Check whether prediction is correct.
if (maxIndexRow != classLabels(0, j))
{
@@ -100,15 +99,13 @@ void Perceptron<LearnPolicy, WeightInitializationPolicy, MatType>::Classify(
{
arma::mat tempLabelMat;
arma::uword maxIndexRow, maxIndexCol;
- double maxVal;
for (int i = 0; i < test.n_cols; i++)
{
- tempLabelMat = weightVectors.submat(0,1,weightVectors.n_rows-1,
- weightVectors.n_cols-1) *
+ tempLabelMat = weightVectors.submat(0, 1, weightVectors.n_rows - 1,
+ weightVectors.n_cols - 1) *
test.col(i) + weightVectors.col(0);
- maxVal = tempLabelMat.max(maxIndexRow, maxIndexCol);
- maxVal *= 2;
+ tempLabelMat.max(maxIndexRow, maxIndexCol);
predictedLabels(0, i) = maxIndexRow;
}
}
--
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