[mlpack-svn] r16731 - mlpack/trunk/src/mlpack/methods/decision_stump
fastlab-svn at coffeetalk-1.cc.gatech.edu
fastlab-svn at coffeetalk-1.cc.gatech.edu
Mon Jun 30 14:13:29 EDT 2014
Author: saxena.udit
Date: Mon Jun 30 14:13:29 2014
New Revision: 16731
Log:
Rewinding the code review
Modified:
mlpack/trunk/src/mlpack/methods/decision_stump/decision_stump_impl.hpp
Modified: mlpack/trunk/src/mlpack/methods/decision_stump/decision_stump_impl.hpp
==============================================================================
--- mlpack/trunk/src/mlpack/methods/decision_stump/decision_stump_impl.hpp (original)
+++ mlpack/trunk/src/mlpack/methods/decision_stump/decision_stump_impl.hpp Mon Jun 30 14:13:29 2014
@@ -157,7 +157,9 @@
{
count++;
if (i == sortedLabels.n_elem - 1)
- {
+ {
+ // if we're at the end, then don't worry about the bucket size
+ // just take this as the last bin.
begin = i - count + 1;
end = i;
@@ -167,17 +169,22 @@
arma::rowvec zSubColAtts((sortedAtt.cols(begin, end)).n_elem);
zSubColAtts.fill(0.0);
- subColLabels = sortedLabels.cols(begin, end) + zSubColLabels;
+ subColLabels = sortedLabels.cols(begin, end) + zSubColLabels;
+ // arma::zeros<arma::rowvec>((sortedLabels.cols(begin, end)).n_elem);
subColAtts = sortedAtt.cols(begin, end) + zSubColAtts;
+ // arma::zeros<arma::rowvec>((sortedAtt.cols(begin, end)).n_elem);
entropy += CalculateEntropy(subColAtts, subColLabels);
i++;
}
else if (sortedLabels(i) != sortedLabels(i + 1))
{
+ // if we're not at the last element of sortedLabels, then check whether
+ // count is less than the current bucket size.
if (count < bucketSize)
- {
+ {
+ // if it is, then take the minimum bucket size anyways
begin = i - count + 1;
end = begin + bucketSize - 1;
@@ -186,6 +193,7 @@
}
else
{
+ // if it is not, then take the bucket size as the value of count.
begin = i - count + 1;
end = i;
}
@@ -197,10 +205,12 @@
zSubColAtts.fill(0.0);
subColLabels = sortedLabels.cols(begin, end) + zSubColLabels;
+ // arma::zeros<arma::rowvec>((sortedLabels.cols(begin, end)).n_elem);
subColAtts = sortedAtt.cols(begin, end) + zSubColAtts;
+ // arma::zeros<arma::rowvec>((sortedAtt.cols(begin, end)).n_elem);
- // Now use subColLabels and subColAtts to calculate entropy.
+ // now using subColLabels and subColAtts to calculate entropuy
entropy += CalculateEntropy(subColAtts, subColLabels);
i = end + 1;
@@ -285,7 +295,7 @@
// Find the most frequent element in subCols so as to assign a label to
// the bucket of subCols.
- mostFreq = CountMostFreq<double>(subCols);
+ mostFreq = CountMostFreq<double>(subCols);//sortedLabels.subvec(begin, end));
split.resize(split.n_elem + 1);
split(split.n_elem - 1) = sortedSplitAtt(begin);
More information about the mlpack-svn
mailing list