[mlpack-svn] r10671 - in mlpack/trunk/src/mlpack: core/io methods/emst methods/gmm methods/hmm methods/kmeans methods/linear_regression methods/naive_bayes methods/nca methods/neighbor_search

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Thu Dec 8 14:29:04 EST 2011


Author: mamidon
Date: 2011-12-08 14:29:03 -0500 (Thu, 08 Dec 2011)
New Revision: 10671

Modified:
   mlpack/trunk/src/mlpack/core/io/cli.cpp
   mlpack/trunk/src/mlpack/methods/emst/emst_main.cpp
   mlpack/trunk/src/mlpack/methods/gmm/gmm_main.cpp
   mlpack/trunk/src/mlpack/methods/hmm/train.cpp
   mlpack/trunk/src/mlpack/methods/kmeans/kmeans_main.cpp
   mlpack/trunk/src/mlpack/methods/linear_regression/linear_regression_main.cpp
   mlpack/trunk/src/mlpack/methods/naive_bayes/nbc_main.cpp
   mlpack/trunk/src/mlpack/methods/nca/nca_main.cpp
   mlpack/trunk/src/mlpack/methods/neighbor_search/allkfn_main.cpp
Log:
Did some more formatting of output. 
Added more shortcuts to methods.

Need to complete formatting.


Modified: mlpack/trunk/src/mlpack/core/io/cli.cpp
===================================================================
--- mlpack/trunk/src/mlpack/core/io/cli.cpp	2011-12-08 19:20:11 UTC (rev 10670)
+++ mlpack/trunk/src/mlpack/core/io/cli.cpp	2011-12-08 19:29:03 UTC (rev 10671)
@@ -429,9 +429,9 @@
   for(iter = gmap.begin(); iter != gmap.end(); iter++) {
     std::string key = iter->first;
     std::string alias = AliasReverseLookup(key);
-    alias = alias.length() ? ", " + alias : alias;
+    alias = alias.length() ? ", -" + alias : alias;
 
-    Log::Info << "\t" << key << alias << " : ";
+    Log::Info << "  --" << key << alias << " : ";
 
     //Now, figure out what type it is, and print it.
     //We can handle strings, ints, bools, floats, doubles.
@@ -481,10 +481,10 @@
   if (param != "" && gmap.count(param)) {
     ParamData data = gmap[param];
     std::string alias = AliasReverseLookup(param);
-    alias = alias.length() ? ", "+alias:alias; 
+    alias = alias.length() ? ", -"+alias:alias; 
      
-    Log::Info << param << alias << " info: " << std::endl;
-    Log::Info << "\t" << HyphenateString(data.desc, 8) << std::endl;
+    Log::Info << "  --" << param << alias << " info: ";
+    Log::Info << HyphenateString(data.desc, 4) << std::endl;
     return;
   } else if(param != "") {
     //User passed a single variable, but it doesn't exist.
@@ -493,8 +493,8 @@
 
   // Print out the descriptions.
   if(docs.programName != "") {
-    Log::Info << "Program: " << docs.programName << std::endl;
-    Log::Info << "\t" << HyphenateString(docs.documentation,8) << std::endl;
+    Log::Info << docs.programName << std::endl;
+    Log::Info << "  " << HyphenateString(docs.documentation,2) << std::endl;
   }
   else
     Log::Info << "Undocumented Program" << std::endl;
@@ -506,11 +506,11 @@
     ParamData data = iter->second;
     std::string desc = data.desc;
     std::string alias = AliasReverseLookup(key);
-    alias = alias.length() ? ", "+alias:alias;
+    alias = alias.length() ? ", -"+alias:alias;
 
     //Now, print the descriptions.
-    Log::Info << "\t" << key << alias << std::endl;
-    Log::Info << "\t\t" << HyphenateString(desc,16) << std::endl;
+    Log::Info << "  --" << key << alias << ": ";
+    Log::Info << HyphenateString(desc,4) << std::endl;
     Log::Info << std::endl;
   }
  

Modified: mlpack/trunk/src/mlpack/methods/emst/emst_main.cpp
===================================================================
--- mlpack/trunk/src/mlpack/methods/emst/emst_main.cpp	2011-12-08 19:20:11 UTC (rev 10670)
+++ mlpack/trunk/src/mlpack/methods/emst/emst_main.cpp	2011-12-08 19:29:03 UTC (rev 10671)
@@ -16,13 +16,13 @@
 
 #include <mlpack/core.hpp>
 
-PARAM_STRING_REQ("input_file", "Data input file.", "");
-PARAM_STRING("output_file", "Data output file.  Stored as an edge list.", "emst", "emst_output.csv");
+PARAM_STRING_REQ("input_file", "Data input file.", "I");
+PARAM_STRING("output_file", "Data output file.  Stored as an edge list.", "O", "emst_output.csv");
 PARAM_FLAG("do_naive", "Compute the MST using .", "");
-PARAM_STRING("naive_output_file", "Naive data output file.", "",
+PARAM_STRING("naive_output_file", "Naive data output file.", "N",
     "naive_output.csv");
-PARAM_INT("leaf_size", "Leaf size in the kd-tree.  Singleton leaves give the empirically best performance at the cost of greater memory requirements.", "", 1);
-PARAM_DOUBLE("total_squared_length", "Squared length of the computed tree.", "", 0.0);
+PARAM_INT("leaf_size", "Leaf size in the kd-tree.  Singleton leaves give the empirically best performance at the cost of greater memory requirements.", "L", 1);
+PARAM_DOUBLE("total_squared_length", "Squared length of the computed tree.", "T", 0.0);
 
 using namespace mlpack;
 using namespace mlpack::emst;

Modified: mlpack/trunk/src/mlpack/methods/gmm/gmm_main.cpp
===================================================================
--- mlpack/trunk/src/mlpack/methods/gmm/gmm_main.cpp	2011-12-08 19:20:11 UTC (rev 10670)
+++ mlpack/trunk/src/mlpack/methods/gmm/gmm_main.cpp	2011-12-08 19:29:03 UTC (rev 10671)
@@ -11,8 +11,8 @@
     " using the EM algorithm to find the maximum likelihood estimate.");
 
 PARAM_STRING_REQ("data", "A file containing the data on which the model has to "
-    "be fit.", "");
-PARAM_INT("gaussians", "g", "", 1);
+    "be fit.", "D");
+PARAM_INT("gaussians", "g", "G", 1);
 
 using namespace mlpack;
 using namespace mlpack::gmm;

Modified: mlpack/trunk/src/mlpack/methods/hmm/train.cpp
===================================================================
--- mlpack/trunk/src/mlpack/methods/hmm/train.cpp	2011-12-08 19:20:11 UTC (rev 10670)
+++ mlpack/trunk/src/mlpack/methods/hmm/train.cpp	2011-12-08 19:29:03 UTC (rev 10671)
@@ -26,22 +26,20 @@
 bool train_viterbi();
 void usage();
 
-PARAM_STRING_REQ("type", "HMM type : discrete | gaussian | mixture.", "");
-PARAM_STRING_REQ("profile", "A file containing HMM profile.", "");
-PARAM_STRING_REQ("seqfile", "Output file for the generated sequences.", "");
-PARAM_STRING("algorithm", "Training algorithm: baumwelch | viterbi.", "",
+PARAM_STRING_REQ("type", "HMM type : discrete | gaussian | mixture.", "T");
+PARAM_STRING_REQ("profile", "A file containing HMM profile.", "P");
+PARAM_STRING_REQ("seqfile", "Output file for the generated sequences.", "S");
+PARAM_STRING("algorithm", "Training algorithm: baumwelch | viterbi.", "A",
 	"baumwelch");
-PARAM_STRING("guess", "File containing guessing HMM model profile.", "",
+PARAM_STRING("guess", "File containing guessing HMM model profile.", "G",
 	"");
 
 
 PARAM(double, "tolerance",
-	"Error tolerance on log-likelihood as a stopping criteria.", "", 1e-3, false);
-PARAM_INT("maxiter", "Maximum number of iterations, default = 500.", "", 500);
-PARAM_INT("numstate", "If no guessing profile specified, at least provide the number of states.", "", 10);
+	"Error tolerance on log-likelihood as a stopping criteria.", "R", 1e-3, false);
+PARAM_INT("maxiter", "Maximum number of iterations, default = 500.", "M", 500);
+PARAM_INT("numstate", "If no guessing profile specified, at least provide the number of states.", "N", 10);
 
-PARAM_MODULE("hmm", "This is a program generating sequences from HMM models.");
-
 void usage() {
   Log::Warn << "Usage:" << std::endl;
   Log::Warn << "  train --type=={discrete|gaussian|mixture} OPTCLIN" << std::endl;

Modified: mlpack/trunk/src/mlpack/methods/kmeans/kmeans_main.cpp
===================================================================
--- mlpack/trunk/src/mlpack/methods/kmeans/kmeans_main.cpp	2011-12-08 19:20:11 UTC (rev 10670)
+++ mlpack/trunk/src/mlpack/methods/kmeans/kmeans_main.cpp	2011-12-08 19:29:03 UTC (rev 10671)
@@ -21,19 +21,19 @@
     "becomes empty, the point furthest from the centroid of the cluster with "
     "maximum variance is taken to fill that cluster.");
 
-PARAM_STRING_REQ("input_file", "Input dataset to perform clustering on.", "");
-PARAM_INT_REQ("clusters", "Number of clusters to find.", "");
+PARAM_STRING_REQ("input_file", "Input dataset to perform clustering on.", "I");
+PARAM_INT_REQ("clusters", "Number of clusters to find.", "C");
 PARAM_FLAG("in_place", "If specified, a column of the learned cluster "
     "assignments will be added to the input dataset file.  In this case "
-    "--output_file is not necessary.", "");
-PARAM_STRING("output_file", "File to write output labels to.", "", "");
-PARAM_FLAG("allow_empty_clusters", "Allow empty clusters to be created.", "");
-PARAM_FLAG("labels_only", "Only output labels into output file.", "");
+    "--output_file is not necessary.", "P");
+PARAM_STRING("output_file", "File to write output labels to.", "O", "");
+PARAM_FLAG("allow_empty_clusters", "Allow empty clusters to be created.", "E");
+PARAM_FLAG("labels_only", "Only output labels into output file.", "L");
 PARAM_DOUBLE("overclustering", "Finds (overclustering * clusters) clusters, "
     "then merges them together until only the desired number of clusters are "
-    "left.", "", 1.0);
+    "left.", "C", 1.0);
 PARAM_INT("max_iterations", "Maximum number of iterations before K-Means "
-    "terminates.", "", 1000);
+    "terminates.", "M", 1000);
 
 int main(int argc, char** argv)
 {

Modified: mlpack/trunk/src/mlpack/methods/linear_regression/linear_regression_main.cpp
===================================================================
--- mlpack/trunk/src/mlpack/methods/linear_regression/linear_regression_main.cpp	2011-12-08 19:20:11 UTC (rev 10670)
+++ mlpack/trunk/src/mlpack/methods/linear_regression/linear_regression_main.cpp	2011-12-08 19:29:03 UTC (rev 10671)
@@ -9,12 +9,12 @@
 
 using namespace mlpack;
 
-PARAM_STRING_REQ("train", "A file containing X", "");
+PARAM_STRING_REQ("train", "A file containing X", "X");
 PARAM_STRING_REQ("test", "A file containing data points to predict on",
-    "");
+    "T");
 PARAM_STRING("responses", "A file containing the y values for X; if not "
     "present, it is assumed the last column of train contains these values.",
-    "", "");
+    "", "R");
 
 PROGRAM_INFO("Simple Linear Regression", "An implementation of simple linear "
     "regression using ordinary least squares.");

Modified: mlpack/trunk/src/mlpack/methods/naive_bayes/nbc_main.cpp
===================================================================
--- mlpack/trunk/src/mlpack/methods/naive_bayes/nbc_main.cpp	2011-12-08 19:20:11 UTC (rev 10670)
+++ mlpack/trunk/src/mlpack/methods/naive_bayes/nbc_main.cpp	2011-12-08 19:29:03 UTC (rev 10671)
@@ -27,12 +27,12 @@
 
 #include "simple_nbc.hpp"
 
-PARAM_INT_REQ("classes", "The number of classes present in the data.", "")
+PARAM_INT_REQ("classes", "The number of classes present in the data.", "C")
 
-PARAM_STRING_REQ("train", "A file containing the training set", "");
-PARAM_STRING_REQ("test", "A file containing the test set", "");
+PARAM_STRING_REQ("train", "A file containing the training set", "R");
+PARAM_STRING_REQ("test", "A file containing the test set", "T");
 PARAM_STRING("output", "The file in which the output of the test would "
-    "be written, defaults to 'output.csv')", "", "output.csv");
+    "be written, defaults to 'output.csv')", "O", "output.csv");
 
 PROGRAM_INFO("Parametric Naive Bayes", "This program test drives the Parametric"
     " Naive Bayes Classifier assuming that the features are sampled from a "

Modified: mlpack/trunk/src/mlpack/methods/nca/nca_main.cpp
===================================================================
--- mlpack/trunk/src/mlpack/methods/nca/nca_main.cpp	2011-12-08 19:20:11 UTC (rev 10670)
+++ mlpack/trunk/src/mlpack/methods/nca/nca_main.cpp	2011-12-08 19:29:03 UTC (rev 10671)
@@ -13,8 +13,8 @@
 PROGRAM_INFO("Neighborhood Components Analysis",
     "documentation not done yet");
 
-PARAM_STRING_REQ("input_file", "Input dataset to run NCA on.", "");
-PARAM_STRING_REQ("output_file", "Output file for learned distance matrix.", "");
+PARAM_STRING_REQ("input_file", "Input dataset to run NCA on.", "I");
+PARAM_STRING_REQ("output_file", "Output file for learned distance matrix.", "O");
 
 using namespace mlpack;
 using namespace mlpack::nca;

Modified: mlpack/trunk/src/mlpack/methods/neighbor_search/allkfn_main.cpp
===================================================================
--- mlpack/trunk/src/mlpack/methods/neighbor_search/allkfn_main.cpp	2011-12-08 19:20:11 UTC (rev 10670)
+++ mlpack/trunk/src/mlpack/methods/neighbor_search/allkfn_main.cpp	2011-12-08 19:29:03 UTC (rev 10671)
@@ -40,15 +40,15 @@
 
 // Define our input parameters that this program will take.
 PARAM_STRING_REQ("reference_file", "File containing the reference dataset.",
-    "");
-PARAM_STRING("query_file", "File containing query points (optional).", "", "");
-PARAM_STRING_REQ("distances_file", "File to output distances into.", "");
-PARAM_STRING_REQ("neighbors_file", "File to output neighbors into.", "");
+    "R");
+PARAM_STRING("query_file", "File containing query points (optional).", "Q", "");
+PARAM_STRING_REQ("distances_file", "File to output distances into.", "D");
+PARAM_STRING_REQ("neighbors_file", "File to output neighbors into.", "N");
 
-PARAM_INT("leaf_size", "Leaf size for tree building.", "", 20);
-PARAM_FLAG("naive", "If true, O(n^2) naive mode is used for computation.", "");
+PARAM_INT("leaf_size", "Leaf size for tree building.", "L", 20);
+PARAM_FLAG("naive", "If true, O(n^2) naive mode is used for computation.", "N");
 PARAM_FLAG("single_mode", "If true, single-tree search is used (as opposed to "
-    "dual-tree search.", "");
+    "dual-tree search.", "S");
 PARAM_INT_REQ("k", "Number of furthest neighbors to find.", "");
 
 int main(int argc, char *argv[])




More information about the mlpack-svn mailing list