[mlpack-git] master: rollback the apis to follow versioning policy (8ebabdd)
gitdub at mlpack.org
gitdub at mlpack.org
Thu Jun 9 12:25:10 EDT 2016
Repository : https://github.com/mlpack/mlpack
On branch : master
Link : https://github.com/mlpack/mlpack/compare/4fa39b6ab0baa1428116d0406264b5452e716d06...97402b9098d9d72889aa795923cf8fd67a4d87bf
>---------------------------------------------------------------
commit 8ebabddf829267008c22393820e07dc753d289c7
Author: Keon Kim <kwk236 at gmail.com>
Date: Fri Jun 10 01:19:56 2016 +0900
rollback the apis to follow versioning policy
>---------------------------------------------------------------
8ebabddf829267008c22393820e07dc753d289c7
.../hoeffding_trees/hoeffding_tree_main.cpp | 40 +++++++++---------
src/mlpack/methods/lars/lars_main.cpp | 20 ++++-----
.../linear_regression/linear_regression_main.cpp | 18 ++++----
.../softmax_regression/softmax_regression_main.cpp | 48 +++++++++++-----------
4 files changed, 63 insertions(+), 63 deletions(-)
diff --git a/src/mlpack/methods/hoeffding_trees/hoeffding_tree_main.cpp b/src/mlpack/methods/hoeffding_trees/hoeffding_tree_main.cpp
index 609bb64..ec95512 100644
--- a/src/mlpack/methods/hoeffding_trees/hoeffding_tree_main.cpp
+++ b/src/mlpack/methods/hoeffding_trees/hoeffding_tree_main.cpp
@@ -37,9 +37,9 @@ PROGRAM_INFO("Hoeffding trees",
"A test file may be specified with the --test_file (-T) option, and if "
"performance numbers are desired for that test set, labels may be specified"
" with the --test_labels_file (-L) option. Predictions for each test point"
- " will be stored in the file specified by --output_predictions_file (-p) and "
+ " will be stored in the file specified by --predictions_file (-p) and "
"probabilities for each predictions will be stored in the file specified by"
- " the --output_probabilities_file (-P) option.");
+ " the --probabilities_file (-P) option.");
PARAM_STRING("training_file", "Training dataset file.", "t", "");
PARAM_STRING("labels_file", "Labels for training dataset.", "l", "");
@@ -56,9 +56,9 @@ PARAM_STRING("output_model_file", "File to save trained tree to.", "M", "");
PARAM_STRING("test_file", "File of testing data.", "T", "");
PARAM_STRING("test_labels_file", "Labels of test data.", "L", "");
-PARAM_STRING("output_predictions_file", "File to output label predictions for"
+PARAM_STRING("predictions_file", "File to output label predictions for"
"test data into.", "p", "");
-PARAM_STRING("output_probabilities_file", "In addition to predicting labels, "
+PARAM_STRING("probabilities_file", "In addition to predicting labels, "
"provide prediction probabilities in this file.", "P", "");
PARAM_STRING("numeric_split_strategy", "The splitting strategy to use for "
@@ -90,18 +90,18 @@ int main(int argc, char** argv)
const string labelsFile = CLI::GetParam<string>("labels_file");
const string inputModelFile = CLI::GetParam<string>("input_model_file");
const string testFile = CLI::GetParam<string>("test_file");
- const string outputPredictionsFile =
- CLI::GetParam<string>("output_predictions_file");
- const string outputProbabilitiesFile =
- CLI::GetParam<string>("output_probabilities_file");
+ const string predictionsFile =
+ CLI::GetParam<string>("predictions_file");
+ const string probabilitiesFile =
+ CLI::GetParam<string>("probabilities_file");
const string numericSplitStrategy =
CLI::GetParam<string>("numeric_split_strategy");
- if ((CLI::HasParam("output_predictions_file") ||
- CLI::HasParam("output_probabilities_file")) &&
+ if ((CLI::HasParam("predictions_file") ||
+ CLI::HasParam("probabilities_file")) &&
!CLI::HasParam("test_file"))
- Log::Fatal << "--test_file must be specified if --output_predictions_file or "
- << "--output_probabilities_file is specified." << endl;
+ Log::Fatal << "--test_file must be specified if --predictions_file or "
+ << "--probabilities_file is specified." << endl;
if (!CLI::HasParam("training_file") && !CLI::HasParam("input_model_file"))
Log::Fatal << "One of --training_file or --input_model_file must be "
@@ -180,10 +180,10 @@ void PerformActions(const typename TreeType::NumericSplit& numericSplit)
const string inputModelFile = CLI::GetParam<string>("input_model_file");
const string outputModelFile = CLI::GetParam<string>("output_model_file");
const string testFile = CLI::GetParam<string>("test_file");
- const string outputPredictionsFile =
- CLI::GetParam<string>("output_predictions_file");
- const string outputProbabilitiesFile =
- CLI::GetParam<string>("output_probabilities_file");
+ const string predictionsFile =
+ CLI::GetParam<string>("predictions_file");
+ const string probabilitiesFile =
+ CLI::GetParam<string>("probabilities_file");
bool batchTraining = CLI::HasParam("batch_mode");
const size_t passes = (size_t) CLI::GetParam<int>("passes");
if (passes > 1)
@@ -317,11 +317,11 @@ void PerformActions(const typename TreeType::NumericSplit& numericSplit)
100.0 << ")." << endl;
}
- if (CLI::HasParam("output_predictions_file"))
- data::Save(outputPredictionsFile, predictions);
+ if (CLI::HasParam("predictions_file"))
+ data::Save(predictionsFile, predictions);
- if (CLI::HasParam("output_probabilities_file"))
- data::Save(outputProbabilitiesFile, probabilities);
+ if (CLI::HasParam("probabilities_file"))
+ data::Save(probabilitiesFile, probabilities);
}
// Check the accuracy on the training set.
diff --git a/src/mlpack/methods/lars/lars_main.cpp b/src/mlpack/methods/lars/lars_main.cpp
index d053772..d9f0ae8 100644
--- a/src/mlpack/methods/lars/lars_main.cpp
+++ b/src/mlpack/methods/lars/lars_main.cpp
@@ -40,7 +40,7 @@ PROGRAM_INFO("LARS", "An implementation of LARS: Least Angle Regression "
" can be saved with the --output_model_file, or, if training is not desired"
" at all, a model can be loaded with --input_model_file. Any output "
"predictions from a test file can be saved into the file specified by the "
- "--output_predictions_file option.");
+ "--output_predictions option.");
PARAM_STRING("input_file", "File containing covariates (X).", "i", "");
PARAM_STRING("responses_file", "File containing y (responses/observations).",
@@ -51,7 +51,7 @@ PARAM_STRING("output_model_file", "File to save model to.", "M", "");
PARAM_STRING("test_file", "File containing points to regress on (test points).",
"t", "");
-PARAM_STRING("output_predictions_file", "If --test_file is specified, this "
+PARAM_STRING("output_predictions", "If --test_file is specified, this "
"file is where the predicted responses will be saved.", "o", "");
PARAM_DOUBLE("lambda1", "Regularization parameter for l1-norm penalty.", "l",
@@ -93,17 +93,17 @@ int main(int argc, char* argv[])
Log::Fatal << "Both --input_file (-i) and --input_model_file (-m) are "
<< "specified, but only one may be specified!" << endl;
- if (!CLI::HasParam("output_predictions_file") &&
+ if (!CLI::HasParam("output_predictions") &&
!CLI::HasParam("output_model_file"))
- Log::Warn << "--output_predictions_file (-o) and --output_model_file (-M) "
+ Log::Warn << "--output_predictions (-o) and --output_model_file (-M) "
<< "are not specified; no results will be saved!" << endl;
- if (CLI::HasParam("output_predictions_file") && !CLI::HasParam("test_file"))
- Log::Warn << "--output_predictions_file (-o) specified, but --test_file "
+ if (CLI::HasParam("output_predictions") && !CLI::HasParam("test_file"))
+ Log::Warn << "--output_predictions (-o) specified, but --test_file "
<< "(-t) is not; no results will be saved." << endl;
- if (CLI::HasParam("test_file") && !CLI::HasParam("output_predictions_file"))
- Log::Warn << "--test_file (-t) specified, but --output_predictions_file "
+ if (CLI::HasParam("test_file") && !CLI::HasParam("output_predictions"))
+ Log::Warn << "--test_file (-t) specified, but --output_predictions "
<< "(-o) is not; no results will be saved." << endl;
// Initialize the object.
@@ -163,10 +163,10 @@ int main(int argc, char* argv[])
lars.Predict(testPoints.t(), predictions, false);
// Save test predictions. One per line, so, don't transpose on save.
- if (CLI::HasParam("output_predictions_file"))
+ if (CLI::HasParam("output_predictions"))
{
const string outputPredictionsFile =
- CLI::GetParam<string>("output_predictions_file");
+ CLI::GetParam<string>("output_predictions");
data::Save(outputPredictionsFile, predictions, true, false);
}
}
diff --git a/src/mlpack/methods/linear_regression/linear_regression_main.cpp b/src/mlpack/methods/linear_regression/linear_regression_main.cpp
index d96ee17..1871acf 100644
--- a/src/mlpack/methods/linear_regression/linear_regression_main.cpp
+++ b/src/mlpack/methods/linear_regression/linear_regression_main.cpp
@@ -22,13 +22,13 @@ PROGRAM_INFO("Simple Linear Regression and Prediction",
" another matrix X' (--test_file):\n\n"
" y' = X' * b\n\n"
"and these predicted responses, y', are saved to a file "
- "(--output_predictions_file). This type of regression is related to "
+ "(--output_predictions). This type of regression is related to "
"least-angle regression, which mlpack implements with the 'lars' "
"executable.");
PARAM_STRING("training_file", "File containing training set X (regressors).",
"t", "");
-PARAM_STRING("training_responses_file", "Optional file containing y "
+PARAM_STRING("training_responses", "Optional file containing y "
"(responses). If not given, the responses are assumed to be the last row "
"of the input file.", "r", "");
@@ -37,7 +37,7 @@ PARAM_STRING("input_model_file", "File containing existing model (parameters).",
PARAM_STRING("output_model_file", "File to save trained model to.", "M", "");
PARAM_STRING("test_file", "File containing X' (test regressors).", "T", "");
-PARAM_STRING("output_predictions_file", "If --test_file is specified, this "
+PARAM_STRING("output_predictions", "If --test_file is specified, this "
"file is where the predicted responses will be saved.", "p", "");
PARAM_DOUBLE("lambda", "Tikhonov regularization for ridge regression. If 0, "
@@ -56,9 +56,9 @@ int main(int argc, char* argv[])
const string inputModelFile = CLI::GetParam<string>("input_model_file");
const string outputModelFile = CLI::GetParam<string>("output_model_file");
const string outputPredictionsFile =
- CLI::GetParam<string>("output_predictions_file");
+ CLI::GetParam<string>("output_predictions");
const string trainingResponsesFile =
- CLI::GetParam<string>("training_responses_file");
+ CLI::GetParam<string>("training_responses");
const string testFile = CLI::GetParam<string>("test_file");
const string trainFile = CLI::GetParam<string>("training_file");
const double lambda = CLI::GetParam<double>("lambda");
@@ -92,8 +92,8 @@ int main(int argc, char* argv[])
<< "both." << endl;
}
- if (CLI::HasParam("test_file") && !CLI::HasParam("output_predictions_file"))
- Log::Warn << "--test_file (-t) specified, but --output_predictions_file "
+ if (CLI::HasParam("test_file") && !CLI::HasParam("output_predictions"))
+ Log::Warn << "--test_file (-t) specified, but --output_predictions "
<< "(-o) is not; no results will be saved." << endl;
// If they specified a model file, we also need a test file or we
@@ -117,7 +117,7 @@ int main(int argc, char* argv[])
Timer::Stop("load_regressors");
// Are the responses in a separate file?
- if (!CLI::HasParam("training_responses_file"))
+ if (CLI::HasParam("training_responses"))
{
// The initial predictors for y, Nx1.
responses = trans(regressors.row(regressors.n_rows - 1));
@@ -182,7 +182,7 @@ int main(int argc, char* argv[])
Timer::Stop("prediction");
// Save predictions.
- if (CLI::HasParam("output_predictions_file"))
+ if (CLI::HasParam("output_predictions"))
data::Save(outputPredictionsFile, predictions, true, false);
}
}
diff --git a/src/mlpack/methods/softmax_regression/softmax_regression_main.cpp b/src/mlpack/methods/softmax_regression/softmax_regression_main.cpp
index d3865b3..7f211a6 100644
--- a/src/mlpack/methods/softmax_regression/softmax_regression_main.cpp
+++ b/src/mlpack/methods/softmax_regression/softmax_regression_main.cpp
@@ -29,8 +29,8 @@ PROGRAM_INFO("Softmax Regression", "This program performs softmax regression, "
"\n\n"
"The program is also able to evaluate a model on test data. A test dataset"
" can be specified with the --test_data (-T) option. Class predictions "
- "will be saved in the file specified with the --output_predictions_file (-p) "
- "option. If labels are specified for the test data, with the --test_labels_file"
+ "will be saved in the file specified with the --predictions_file (-p) "
+ "option. If labels are specified for the test data, with the --test_labels"
" (-L) option, then the program will print the accuracy of the predictions "
"on the given test set and its corresponding labels.");
@@ -41,16 +41,16 @@ PARAM_STRING("labels_file", "A file containing labels (0 or 1) for the points "
"in the training set (y). The labels must order as a row", "l", "");
// Model loading/saving.
-PARAM_STRING("input_model_file_file", "File containing existing model (parameters).",
+PARAM_STRING("input_model_file", "File containing existing model (parameters).",
"m", "");
-PARAM_STRING("output_model_file_file", "File to save trained softmax regression "
+PARAM_STRING("output_model_file", "File to save trained softmax regression "
"model to.", "M", "");
// Testing.
PARAM_STRING("test_data", "File containing test dataset.", "T", "");
-PARAM_STRING("output_predictions_file", "File to save predictions for test dataset "
+PARAM_STRING("predictions_file", "File to save predictions for test dataset "
"into.", "p", "");
-PARAM_STRING("test_labels_file", "File containing test labels.", "L", "");
+PARAM_STRING("test_labels", "File containing test labels.", "L", "");
// Softmax configuration options.
PARAM_INT("max_iterations", "Maximum number of iterations before termination.",
@@ -73,7 +73,7 @@ size_t CalculateNumberOfClasses(const size_t numClasses,
// Test the accuracy of the model.
template<typename Model>
void TestPredictAcc(const string& testFile,
- const string& outputPredictionsFile,
+ const string& predictionsFile,
const string& testLabels,
const size_t numClasses,
const Model& model);
@@ -97,10 +97,10 @@ int main(int argc, char** argv)
const std::string inputModelFile =
CLI::GetParam<std::string>("input_model_file");
const string outputModelFile = CLI::GetParam<string>("output_model_file");
- const string testLabelsFile = CLI::GetParam<string>("test_labels_file");
+ const string testLabelsFile = CLI::GetParam<string>("test_labels");
const int maxIterations = CLI::GetParam<int>("max_iterations");
- const string outputPredictionsFile =
- CLI::GetParam<string>("output_predictions_file");
+ const string predictionsFile =
+ CLI::GetParam<string>("predictions_file");
// One of inputFile and modelFile must be specified.
if (!CLI::HasParam("input_model_file") && !CLI::HasParam("training_file"))
@@ -117,10 +117,10 @@ int main(int argc, char** argv)
// Make sure we have an output file of some sort.
if (!CLI::HasParam("output_model_file") &&
- !CLI::HasParam("test_labels_file") &&
- !CLI::HasParam("output_predictions_file"))
- Log::Warn << "None of --output_model_file, --test_labels_file, or "
- << "--output_predictions_file are set; no results from this program "
+ !CLI::HasParam("test_labels") &&
+ !CLI::HasParam("predictions_file"))
+ Log::Warn << "None of --output_model_file, --test_labels, or "
+ << "--predictions_file are set; no results from this program "
<< " will be saved." << endl;
@@ -131,8 +131,8 @@ int main(int argc, char** argv)
maxIterations);
TestPredictAcc(CLI::GetParam<string>("test_data"),
- CLI::GetParam<string>("output_predictions_file"),
- CLI::GetParam<string>("test_labels_file"),
+ CLI::GetParam<string>("predictions_file"),
+ CLI::GetParam<string>("test_labels"),
sm->NumClasses(), *sm);
if (CLI::HasParam("output_model_file"))
@@ -157,7 +157,7 @@ size_t CalculateNumberOfClasses(const size_t numClasses,
template<typename Model>
void TestPredictAcc(const string& testFile,
- const string& outputPredictionsFile,
+ const string& predictionsFile,
const string& testLabelsFile,
size_t numClasses,
const Model& model)
@@ -165,19 +165,19 @@ void TestPredictAcc(const string& testFile,
using namespace mlpack;
// If there is no test set, there is nothing to test on.
- if (testFile.empty() && outputPredictionsFile.empty() && testLabelsFile.empty())
+ if (testFile.empty() && predictionsFile.empty() && testLabelsFile.empty())
return;
if (!testLabelsFile.empty() && testFile.empty())
{
- Log::Warn << "--test_labels_file specified, but --test_file is not specified."
+ Log::Warn << "--test_labels specified, but --test_file is not specified."
<< " The parameter will be ignored." << endl;
return;
}
- if (!outputPredictionsFile.empty() && testFile.empty())
+ if (!predictionsFile.empty() && testFile.empty())
{
- Log::Warn << "--output_predictions_file specified, but --test_file is not "
+ Log::Warn << "--predictions_file specified, but --test_file is not "
<< "specified. The parameter will be ignored." << endl;
return;
}
@@ -190,8 +190,8 @@ void TestPredictAcc(const string& testFile,
model.Predict(testData, predictLabels);
// Save predictions, if desired.
- if (!outputPredictionsFile.empty())
- data::Save(outputPredictionsFile, predictLabels);
+ if (!predictionsFile.empty())
+ data::Save(predictionsFile, predictLabels);
// Calculate accuracy, if desired.
if (!testLabelsFile.empty())
@@ -204,7 +204,7 @@ void TestPredictAcc(const string& testFile,
if (testData.n_cols != testLabels.n_elem)
{
Log::Fatal << "Test data in --test_data has " << testData.n_cols
- << " points, but labels in --test_labels_file have "
+ << " points, but labels in --test_labels have "
<< testLabels.n_elem << " labels!" << endl;
}
More information about the mlpack-git
mailing list