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

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Wed Apr 17 15:11:07 EDT 2013


Author: rcurtin
Date: 2013-04-17 15:11:07 -0400 (Wed, 17 Apr 2013)
New Revision: 14911

Modified:
   mlpack/trunk/src/mlpack/methods/kmeans/kmeans.hpp
Log:
Oops, this is not the accessor/mutator design methodology we are using.


Modified: mlpack/trunk/src/mlpack/methods/kmeans/kmeans.hpp
===================================================================
--- mlpack/trunk/src/mlpack/methods/kmeans/kmeans.hpp	2013-04-17 19:03:32 UTC (rev 14910)
+++ mlpack/trunk/src/mlpack/methods/kmeans/kmeans.hpp	2013-04-17 19:11:07 UTC (rev 14911)
@@ -109,39 +109,16 @@
                const size_t clusters,
                arma::Col<size_t>& assignments) const;
 
-  /**
-   * Return the overclustering factor.
-   */
+  //! Return the overclustering factor.
   double OverclusteringFactor() const { return overclusteringFactor; }
+  //! Set the overclustering factor.  Must be greater than 1.
+  double& OverclusteringFactor() { return overclusteringFactor; }
 
-  /**
-   * Set the overclustering factor.
-   */
-  void OverclusteringFactor(const double overclusteringFactor)
-  {
-    if (overclusteringFactor < 1.0)
-    {
-      Log::Warn << "KMeans::OverclusteringFactor(): invalid value (<= 1.0) "
-          "ignored." << std::endl;
-      return;
-    }
-
-    this->overclusteringFactor = overclusteringFactor;
-  }
-
-  /**
-   * Get the maximum number of iterations.
-   */
+  //! Get the maximum number of iterations.
   size_t MaxIterations() const { return maxIterations; }
+  //! Set the maximum number of iterations.
+  size_t& MaxIterations() { return maxIterations; }
 
-  /**
-   * Set the maximum number of iterations.
-   */
-  void MaxIterations(const size_t maxIterations)
-  {
-    this->maxIterations = maxIterations;
-  }
-
   //! Get the distance metric.
   const DistanceMetric& Metric() const { return metric; }
   //! Modify the distance metric.
@@ -154,9 +131,7 @@
 
   //! Get the empty cluster policy.
   const EmptyClusterPolicy& EmptyClusterAction() const
-  {
-    return emptyClusterAction;
-  }
+  { return emptyClusterAction; }
   //! Modify the empty cluster policy.
   EmptyClusterPolicy& EmptyClusterAction() { return emptyClusterAction; }
 




More information about the mlpack-svn mailing list