[mlpack-svn] r10861 - mlpack/trunk/src/mlpack/methods/kmeans
fastlab-svn at coffeetalk-1.cc.gatech.edu
fastlab-svn at coffeetalk-1.cc.gatech.edu
Fri Dec 16 13:48:00 EST 2011
Author: vlad321
Date: 2011-12-16 13:48:00 -0500 (Fri, 16 Dec 2011)
New Revision: 10861
Modified:
mlpack/trunk/src/mlpack/methods/kmeans/kmeans_main.cpp
Log:
Formatting of /kmeans.
Modified: mlpack/trunk/src/mlpack/methods/kmeans/kmeans_main.cpp
===================================================================
--- mlpack/trunk/src/mlpack/methods/kmeans/kmeans_main.cpp 2011-12-16 18:43:39 UTC (rev 10860)
+++ mlpack/trunk/src/mlpack/methods/kmeans/kmeans_main.cpp 2011-12-16 18:48:00 UTC (rev 10861)
@@ -21,13 +21,13 @@
"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.", "i");
+PARAM_STRING_REQ("inputFile", "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.", "p");
-PARAM_STRING("output_file", "File to write output labels or labeled data to.",
+ "--outputFile is not necessary.", "p");
+PARAM_STRING("outputFile", "File to write output labels or labeled data to.",
"o", "output.csv");
PARAM_FLAG("allow_empty_clusters", "Allow empty clusters to be created.", "e");
PARAM_FLAG("labels_only", "Only output labels into output file.", "l");
@@ -45,7 +45,7 @@
srand(time(NULL));
// Now do validation of options.
- string input_file = CLI::GetParam<string>("input_file");
+ string inputFile = CLI::GetParam<string>("inputFile");
int clusters = CLI::GetParam<int>("clusters");
if (clusters < 1)
{
@@ -68,15 +68,15 @@
}
// Make sure we have an output file if we're not doing the work in-place.
- if (!CLI::HasParam("in_place") && !CLI::HasParam("output_file"))
+ if (!CLI::HasParam("in_place") && !CLI::HasParam("outputFile"))
{
- Log::Fatal << "--output_file not specified (and --in_place not set)."
+ Log::Fatal << "--outputFile not specified (and --in_place not set)."
<< std::endl;
}
// Load our dataset.
arma::mat dataset;
- data::Load(input_file.c_str(), dataset);
+ data::Load(inputFile.c_str(), dataset);
// Now create the KMeans object. Because we could be using different types,
// it gets a little weird...
@@ -107,16 +107,16 @@
dataset.insert_rows(dataset.n_rows, trans(converted));
// Save the dataset.
- data::Save(input_file.c_str(), dataset);
+ data::Save(inputFile.c_str(), dataset);
}
else
{
if (CLI::HasParam("labels_only"))
{
// Save only the labels.
- string output_file = CLI::GetParam<string>("output_file");
+ string outputFile = CLI::GetParam<string>("outputFile");
arma::Mat<size_t> output = trans(assignments);
- data::Save(output_file.c_str(), output);
+ data::Save(outputFile.c_str(), output);
}
else
{
@@ -128,8 +128,8 @@
dataset.insert_rows(dataset.n_rows, trans(converted));
// Now save, in the different file.
- string output_file = CLI::GetParam<string>("output_file");
- data::Save(output_file.c_str(), dataset);
+ string outputFile = CLI::GetParam<string>("outputFile");
+ data::Save(outputFile.c_str(), dataset);
}
}
}
More information about the mlpack-svn
mailing list