[mlpack-git] master, mlpack-1.0.x: Use bool instead of int. (b3b1d55)
gitdub at big.cc.gt.atl.ga.us
gitdub at big.cc.gt.atl.ga.us
Thu Mar 5 21:49:24 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 b3b1d55773fd9d39fa68075d470260f1efd3cb0f
Author: Ryan Curtin <ryan at ratml.org>
Date: Tue Jun 24 05:23:01 2014 +0000
Use bool instead of int.
>---------------------------------------------------------------
b3b1d55773fd9d39fa68075d470260f1efd3cb0f
src/mlpack/methods/decision_stump/decision_stump.hpp | 2 +-
src/mlpack/methods/decision_stump/decision_stump_impl.hpp | 14 +++++++-------
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/mlpack/methods/decision_stump/decision_stump.hpp b/src/mlpack/methods/decision_stump/decision_stump.hpp
index ed1dbff..5db64be 100644
--- a/src/mlpack/methods/decision_stump/decision_stump.hpp
+++ b/src/mlpack/methods/decision_stump/decision_stump.hpp
@@ -56,7 +56,7 @@ class DecisionStump
int splitCol;
//! Flag value for distinct input class labels.
- int oneClass;
+ bool oneClass;
//! Size of bucket while determining splitting criterion.
size_t bucketSize;
diff --git a/src/mlpack/methods/decision_stump/decision_stump_impl.hpp b/src/mlpack/methods/decision_stump/decision_stump_impl.hpp
index b3ef678..9c387c7 100644
--- a/src/mlpack/methods/decision_stump/decision_stump_impl.hpp
+++ b/src/mlpack/methods/decision_stump/decision_stump_impl.hpp
@@ -43,14 +43,14 @@ DecisionStump<MatType>::DecisionStump(const MatType& data,
{
// If the classLabels are all identical, the default class is the only
// class.
- oneClass = 1;
+ oneClass = true;
defaultClass = classLabels(0);
}
else
{
// If classLabels are not all identical, proceed with training.
- oneClass = 0;
+ oneClass = false;
int bestAtt = -1;
double entropy;
double bestEntropy = DBL_MAX;
@@ -96,14 +96,14 @@ template<typename MatType>
void DecisionStump<MatType>::Classify(const MatType& test,
arma::Row<size_t>& predictedLabels)
{
- int flag;
+ bool flag;
double val;
if (!oneClass)
{
for (int i = 0; i < test.n_cols; i++)
{
int j = 0;
- flag = 0;
+ flag = false;
val = test(splitCol,i);
while ((j < split.n_rows) && (!flag))
@@ -111,19 +111,19 @@ void DecisionStump<MatType>::Classify(const MatType& test,
if (val < split(j, 0) && (!j))
{
predictedLabels(i) = split(0, 1);
- flag = 1;
+ flag = true;
}
else if (val >= split(j, 0))
{
if (j == split.n_rows - 1)
{
predictedLabels(i) = split(split.n_rows - 1, 1);
- flag = 1;
+ flag = true;
}
else if (val < split(j + 1, 0))
{
predictedLabels(i) = split(j, 1);
- flag = 1;
+ flag = true;
}
}
j++;
More information about the mlpack-git
mailing list