[mlpack-git] master, mlpack-1.0.x: Minor improvement. No major functionality changes (aafe06c)
gitdub at big.cc.gt.atl.ga.us
gitdub at big.cc.gt.atl.ga.us
Thu Mar 5 21:52:42 EST 2015
Repository : https://github.com/mlpack/mlpack
On branches: master,mlpack-1.0.x
Link : https://github.com/mlpack/mlpack/compare/904762495c039e345beba14c1142fd719b3bd50e...f94823c800ad6f7266995c700b1b630d5ffdcf40
>---------------------------------------------------------------
commit aafe06cf38907e466affb41489565104c7203efa
Author: Udit Saxena <saxena.udit at gmail.com>
Date: Thu Jul 10 13:49:08 2014 +0000
Minor improvement. No major functionality changes
>---------------------------------------------------------------
aafe06cf38907e466affb41489565104c7203efa
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;
}
}
More information about the mlpack-git
mailing list