[mlpack-svn] r14050 - mlpack/trunk/src/mlpack/methods/kmeans

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Fri Dec 21 15:52:13 EST 2012


Author: rcurtin
Date: 2012-12-21 15:52:12 -0500 (Fri, 21 Dec 2012)
New Revision: 14050

Modified:
   mlpack/trunk/src/mlpack/methods/kmeans/kmeans_impl.hpp
Log:
Update for MRKDStatistic API change.


Modified: mlpack/trunk/src/mlpack/methods/kmeans/kmeans_impl.hpp
===================================================================
--- mlpack/trunk/src/mlpack/methods/kmeans/kmeans_impl.hpp	2012-12-21 20:52:04 UTC (rev 14049)
+++ mlpack/trunk/src/mlpack/methods/kmeans/kmeans_impl.hpp	2012-12-21 20:52:12 UTC (rev 14050)
@@ -148,7 +148,7 @@
     // Add the root node of the tree to the stack.
     stack.push(&tree);
     // Set the top level whitelist.
-    tree.Stat().whiteList.resize(centroids.n_cols, true);
+    tree.Stat().Whitelist().resize(centroids.n_cols, true);
 
     // Traverse the tree.
     while (!stack.empty())
@@ -169,7 +169,7 @@
       // the centroids to every point the node contains.
       if (node->IsLeaf())
       {
-        for (size_t i = mrkd.begin; i < mrkd.count + mrkd.begin; ++i)
+        for (size_t i = mrkd.Begin(); i < mrkd.Count() + mrkd.Begin(); ++i)
         {
           // Initialize minDistance to be nonzero.
           double minDistance = metric::SquaredEuclideanDistance::Evaluate(
@@ -179,7 +179,7 @@
           for (size_t j = 1; j < centroids.n_cols; ++j)
           {
             // If this centroid is not in the whitelist, skip it.
-            if (!mrkd.whiteList[j])
+            if (!mrkd.Whitelist()[j])
             {
               ++skip;
               continue;
@@ -222,7 +222,7 @@
         bool noDomination = false;
 
         // Calculate the center of mass of this hyperrectangle.
-        arma::vec center = mrkd.centerOfMass / mrkd.count;
+        arma::vec center = mrkd.CenterOfMass() / mrkd.Count();
 
         // Set the minDistance to the maximum value of a double so any value
         // must be smaller than this.
@@ -239,7 +239,7 @@
         for (size_t i = 0; i < centroids.n_cols; ++i)
         {
           // If this centroid is not in the whitelist, skip it.
-          if (!mrkd.whiteList[i])
+          if (!mrkd.Whitelist()[i])
           {
             ++skip;
             continue;
@@ -349,7 +349,7 @@
               continue;
             // If this centroid is blacklisted for this hyperrectangle, then
             // we skip it.
-            if (!mrkd.whiteList[i])
+            if (!mrkd.Whitelist()[i])
             {
               ++skip;
               continue;
@@ -382,8 +382,8 @@
             double distanceMin = 0.0;
             for (size_t k = 0; k < dimensionality; ++k)
             {
-              double ci = centroids(k,i);
-              double cm = centroids(k,minIndex);
+              double ci = centroids(k, i);
+              double cm = centroids(k, minIndex);
               if (ci > cm)
               {
                 double hi = bound[k].Hi();
@@ -412,14 +412,14 @@
               }
             }
 
-            if(distanceMin >= distancei)
+            if (distanceMin >= distancei)
             {
               noDomination = true;
               break;
             }
             else
             {
-              mrkd.whiteList[i] = false;
+              mrkd.Whitelist()[i] = false;
             }
           }
         }
@@ -430,10 +430,10 @@
         {
           // Adjust the new centroid sum for the min distance point to this
           // hyperrectangle by the center of mass of this hyperrectangle.
-          newCentroids.col(minIndex) += mrkd.centerOfMass;
+          newCentroids.col(minIndex) += mrkd.CenterOfMass();
 
           // Increment the counts for this centroid.
-          counts(minIndex) += mrkd.count;
+          counts(minIndex) += mrkd.Count();
 
           // Update all assignments for this node.
           const size_t begin = node->Begin();
@@ -448,7 +448,7 @@
               assignments(j) = minIndex;
             }
           }
-          mrkd.dominatingCentroid = minIndex;
+          mrkd.DominatingCentroid() = minIndex;
 
           // Keep track of the number of times we found a dominating centroid.
           ++dominations;
@@ -463,8 +463,8 @@
           stack.push(node->Right());
 
           // (Re)Initialize the whiteList for the children.
-          node->Left()->Stat().whiteList = mrkd.whiteList;
-          node->Right()->Stat().whiteList = mrkd.whiteList;
+          node->Left()->Stat().Whitelist() = mrkd.Whitelist();
+          node->Right()->Stat().Whitelist() = mrkd.Whitelist();
         }
       }
 




More information about the mlpack-svn mailing list