[mlpack-svn] r10516 - mlpack/trunk/src/mlpack/methods/emst
fastlab-svn at coffeetalk-1.cc.gatech.edu
fastlab-svn at coffeetalk-1.cc.gatech.edu
Fri Dec 2 15:08:52 EST 2011
Author: rcurtin
Date: 2011-12-02 15:08:52 -0500 (Fri, 02 Dec 2011)
New Revision: 10516
Modified:
mlpack/trunk/src/mlpack/methods/emst/dtb.hpp
mlpack/trunk/src/mlpack/methods/emst/emst_main.cpp
Log:
Prune CLI from the internals of DTB.
Modified: mlpack/trunk/src/mlpack/methods/emst/dtb.hpp
===================================================================
--- mlpack/trunk/src/mlpack/methods/emst/dtb.hpp 2011-12-02 20:08:42 UTC (rev 10515)
+++ mlpack/trunk/src/mlpack/methods/emst/dtb.hpp 2011-12-02 20:08:52 UTC (rev 10516)
@@ -543,7 +543,6 @@
mlpack::Log::Info << "number_both_recursions" << std::endl;
*/
- mlpack::CLI::GetParam<double>("dtb/total_squared_length") = total_dist_;
} // OutputResults_
/////////// Public Functions ///////////////////
@@ -557,24 +556,21 @@
* Takes in a reference to the data set. Copies the data, builds the tree,
* and initializes all of the member variables.
*/
- void Init(const arma::mat& data)
+ void Init(const arma::mat& data, bool naive = false, size_t leafSize = 1)
{
number_of_edges_ = 0;
data_points_ = data; // copy
- do_naive_ = CLI::GetParam<bool>("naive/do_naive");
+ do_naive_ = naive;
if (!do_naive_)
{
// Default leaf size is 1
// This gives best pruning empirically
// Use leaf_size=1 unless space is a big concern
- CLI::GetParam<int>("tree/leaf_size") =
- CLI::GetParam<int>("emst/leaf_size");
-
Timers::StartTimer("emst/tree_building");
- tree_ = new DTBTree(data_points_, old_from_new_permutation_);
+ tree_ = new DTBTree(data_points_, old_from_new_permutation_, leafSize);
Timers::StopTimer("emst/tree_building");
}
Modified: mlpack/trunk/src/mlpack/methods/emst/emst_main.cpp
===================================================================
--- mlpack/trunk/src/mlpack/methods/emst/emst_main.cpp 2011-12-02 20:08:42 UTC (rev 10515)
+++ mlpack/trunk/src/mlpack/methods/emst/emst_main.cpp 2011-12-02 20:08:52 UTC (rev 10516)
@@ -45,9 +45,8 @@
Log::Info << "Running naive algorithm.\n";
DualTreeBoruvka naive;
- //CLI::GetParam<bool>("naive/do_naive") = true;
- naive.Init(data_points);
+ naive.Init(data_points, true);
arma::mat naive_results;
naive.ComputeMST(naive_results);
@@ -62,8 +61,9 @@
Log::Info << "Data read, building tree.\n";
/////////////// Initialize DTB //////////////////////
+ size_t leafSize = CLI::GetParam<int>("emst/leaf_size");
DualTreeBoruvka dtb;
- dtb.Init(data_points);
+ dtb.Init(data_points, false, leafSize);
Log::Info << "Tree built, running algorithm.\n\n";
More information about the mlpack-svn
mailing list