[mlpack] 93/324: Rewinding the code review
Barak A. Pearlmutter
barak+git at cs.nuim.ie
Sun Aug 17 08:21:59 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 d3d63f8bd6560393fc331242a439013018f9e1e0
Author: saxena.udit <saxena.udit at 9d5b8971-822b-0410-80eb-d18c1038ef23>
Date: Mon Jun 30 18:13:29 2014 +0000
Rewinding the code review
git-svn-id: http://svn.cc.gatech.edu/fastlab/mlpack/trunk@16731 9d5b8971-822b-0410-80eb-d18c1038ef23
---
.../methods/decision_stump/decision_stump_impl.hpp | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/src/mlpack/methods/decision_stump/decision_stump_impl.hpp b/src/mlpack/methods/decision_stump/decision_stump_impl.hpp
index 625e12e..051d1da 100644
--- a/src/mlpack/methods/decision_stump/decision_stump_impl.hpp
+++ b/src/mlpack/methods/decision_stump/decision_stump_impl.hpp
@@ -157,7 +157,9 @@ double DecisionStump<MatType>::SetupSplitAttribute(
{
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 @@ double DecisionStump<MatType>::SetupSplitAttribute(
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 @@ double DecisionStump<MatType>::SetupSplitAttribute(
}
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 @@ double DecisionStump<MatType>::SetupSplitAttribute(
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 @@ void DecisionStump<MatType>::TrainOnAtt(const arma::rowvec& attribute,
// 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);
--
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