[mlpack-svn] [MLPACK] #118: Use consistent accessors and mutators

MLPACK Trac trac at coffeetalk-1.cc.gatech.edu
Sat Nov 26 18:00:38 EST 2011


#118: Use consistent accessors and mutators
------------------------------------------+---------------------------------
  Reporter:  rcurtin                      |        Owner:            
      Type:  wishlist                     |       Status:  new       
  Priority:  major                        |    Milestone:  MLPACK 1.0
 Component:  MLPACK                       |   Resolution:            
  Keywords:  mlpack getter setter public  |     Blocking:  120       
Blocked By:                               |  
------------------------------------------+---------------------------------

Comment (by rcurtin):

 I can come up with a use case which exploits that behavior, using KMeans
 and MahalanobisDistance, which stores an internal covariance matrix.  I'll
 leave out a lot of details, but imagine an iterative process that is
 learning the best Mahalanobis covariance matrix for KMeans.

 {{{
 int main()
 {
   // This data is very high-dimensional!  Say, hundreds of thousands of
 dimensions.
   arma::mat data;
   data::Load("data.csv", data);

   // data.n_rows is the dimensionality of the data -- very large.
   arma::mat covariance(data.n_rows, data.n_rows);
   GenerateInitialMahalanobisGuess(covariance); // Take a first guess
 somehow.

   // Create the Mahalanobis distance.
   MahalanobisDistance md(covariance);

   // Create the KMeans object.
   KMeans<MahalanobisDistance> kmeans(md); // Other parameters omitted...

   while (!converged)
   {
     // Store our assignments in this.
     arma::Col<size_t> assignments;

     // Run K-Means.
     kmeans.Cluster(data, 5 /* arbitrary number of clusters */,
 assignments);

     // Find some measure of goodness.
     double goodness = Goodness(assignments);

     // Now somehow magically update our distance.
     UpdateDistance(kmeans.Metric().Covariance());
   }
 }
 }}}

 Hopefully that makes some sense?

-- 
Ticket URL: <http://trac.research.cc.gatech.edu/fastlab/ticket/118#comment:13>
MLPACK <www.fast-lab.org>
MLPACK is an intuitive, fast, and scalable C++ machine learning library developed by the FASTLAB at Georgia Tech under Dr. Alex Gray.


More information about the mlpack-svn mailing list