mlpack
master
|
Go to the source code of this file.
Classes | |
class | mlpack::data::DatasetMapper< PolicyType > |
Auxiliary information for a dataset, including mappings to/from strings and the datatype of each dimension. More... | |
Namespaces | |
mlpack | |
Linear algebra utility functions, generally performed on matrices or vectors. | |
mlpack::data | |
Functions to load and save matrices and models. | |
Macros | |
#define | PARAM_DOUBLE_IN(ID, DESC, ALIAS, DEF) PARAM_IN(double, ID, DESC, ALIAS, DEF, false) |
Define a double input parameter. More... | |
#define | PARAM_DOUBLE_IN_REQ(ID, DESC, ALIAS) PARAM_IN(double, ID, DESC, ALIAS, 0.0d, true) |
Define a required double parameter. More... | |
#define | PARAM_DOUBLE_OUT(ID, DESC) PARAM_OUT(double, ID, DESC, "", 0.0, false) |
Define a double output parameter. More... | |
#define | PARAM_FLAG(ID, DESC, ALIAS) PARAM_IN(bool, ID, DESC, ALIAS, false, false); |
Define a flag parameter. More... | |
#define | PARAM_IN(T, ID, DESC, ALIAS, DEF, REQ) |
Define an input parameter. More... | |
#define | PARAM_INT_IN(ID, DESC, ALIAS, DEF) PARAM_IN(int, ID, DESC, ALIAS, DEF, false) |
Define an integer input parameter. More... | |
#define | PARAM_INT_IN_REQ(ID, DESC, ALIAS) PARAM_IN(int, ID, DESC, ALIAS, 0, true) |
Define a required integer input parameter. More... | |
#define | PARAM_INT_OUT(ID, DESC) PARAM_IN(int, ID, DESC, "", 0, false) |
Define an integer output parameter. More... | |
#define | PARAM_MATRIX(ID, DESC, ALIAS, REQ, TRANS, IN) |
#define | PARAM_MATRIX_AND_INFO_IN(ID, DESC, ALIAS) PARAM_IN(TUPLE_TYPE, ID, DESC, ALIAS, TUPLE_TYPE(), false) |
#define | PARAM_MATRIX_IN(ID, DESC, ALIAS) PARAM_MATRIX(ID, DESC, ALIAS, false, true, true) |
Define a matrix input parameter. More... | |
#define | PARAM_MATRIX_IN_REQ(ID, DESC, ALIAS) PARAM_MATRIX(ID, DESC, ALIAS, true, true, true) |
Define a required matrix input parameter. More... | |
#define | PARAM_MATRIX_OUT(ID, DESC, ALIAS) PARAM_MATRIX(ID, DESC, ALIAS, false, true, false) |
Define a matrix output parameter. More... | |
#define | PARAM_MODEL(TYPE, ID, DESC, ALIAS, REQ, IN) |
#define | PARAM_MODEL_IN(TYPE, ID, DESC, ALIAS) PARAM_MODEL(TYPE, ID, DESC, ALIAS, false, true) |
Define an input model. More... | |
#define | PARAM_MODEL_IN_REQ(TYPE, ID, DESC, ALIAS) PARAM_MODEL(TYPE, ID, DESC, ALIAS, true, true) |
Define a required input model. More... | |
#define | PARAM_MODEL_OUT(TYPE, ID, DESC, ALIAS) PARAM_MODEL(TYPE, ID, DESC, ALIAS, false, false) |
Define an output model. More... | |
#define | PARAM_OUT(T, ID, DESC, ALIAS, DEF, REQ) |
#define | PARAM_STRING_IN(ID, DESC, ALIAS, DEF) PARAM_IN(std::string, ID, DESC, ALIAS, DEF, false) |
Define a string input parameter. More... | |
#define | PARAM_STRING_IN_REQ(ID, DESC, ALIAS) PARAM_IN(std::string, ID, DESC, ALIAS, "", true) |
Define a required string parameter. More... | |
#define | PARAM_STRING_OUT(ID, DESC, ALIAS) PARAM_OUT(std::string, ID, DESC, ALIAS, "", false) |
Define a string output parameter. More... | |
#define | PARAM_TMATRIX_IN(ID, DESC, ALIAS) PARAM_MATRIX(ID, DESC, ALIAS, false, false, true) |
Define a transposed matrix input parameter. More... | |
#define | PARAM_TMATRIX_IN_REQ(ID, DESC, ALIAS) PARAM_MATRIX(ID, DESC, ALIAS, true, false, true) |
Define a required transposed matrix input parameter. More... | |
#define | PARAM_TMATRIX_OUT(ID, DESC, ALIAS) PARAM_MATRIX(ID, DESC, ALIAS, false, false, false) |
Define a transposed matrix output parameter. More... | |
#define | PARAM_UMATRIX(ID, DESC, ALIAS, REQ, TRANS, IN) |
#define | PARAM_UMATRIX_IN(ID, DESC, ALIAS) PARAM_UMATRIX(ID, DESC, ALIAS, false, true, true) |
Define an unsigned matrix input parameter (arma::Mat<size_t>). More... | |
#define | PARAM_UMATRIX_IN_REQ(ID, DESC, ALIAS) PARAM_UMATRIX(ID, DESC, ALIAS, true, true, true) |
Define a required unsigned matrix input parameter (arma::Mat<size_t>). More... | |
#define | PARAM_UMATRIX_OUT(ID, DESC, ALIAS) PARAM_UMATRIX(ID, DESC, ALIAS, false, true, false) |
Define an unsigned matrix output parameter (arma::Mat<size_t>). More... | |
#define | PARAM_VECTOR_IN(T, ID, DESC, ALIAS) PARAM_IN(std::vector<T>, ID, DESC, ALIAS, std::vector<T>(), false) |
Define a vector input parameter. More... | |
#define | PARAM_VECTOR_IN_REQ(T, ID, DESC, ALIAS) PARAM_IN(std::vector<T>, ID, DESC, ALIAS, std::vector<T>(), true); |
Define a required vector parameter. More... | |
#define | PARAM_VECTOR_OUT(T, ID) PARAM_OUT(std::vector<T>, ID, DESC, "", std::vector<T>(), false) |
Define a vector output parameter. More... | |
#define | PROGRAM_INFO(NAME, DESC) |
Document an executable. More... | |
#define | TUPLE_TYPE std::tuple<mlpack::data::DatasetInfo, arma::mat> |
Define an input DatasetInfo/matrix parameter. More... | |
Definition of PARAM_*_IN() and PARAM_*_OUT() macros, as well as the PROGRAM_INFO() macro, which are used to define input and output parameters of command-line programs and bindings to other languages.
mlpack is free software; you may redistribute it and/or modify it under the terms of the 3-clause BSD license. You should have received a copy of the 3-clause BSD license along with mlpack. If not, see http://www.opensource.org/licenses/BSD-3-Clause for more information.
Definition in file param.hpp.
#define PARAM_DOUBLE_IN | ( | ID, | |
DESC, | |||
ALIAS, | |||
DEF | |||
) | PARAM_IN(double, ID, DESC, ALIAS, DEF, false) |
Define a double input parameter.
The parameter can then be specified on the command line with –ID=value.
ID | Name of the parameter. |
DESC | Quick description of the parameter (1-2 sentences). |
ALIAS | An alias for the parameter (one letter). |
DEF | Default value of the parameter. |
#define PARAM_DOUBLE_IN_REQ | ( | ID, | |
DESC, | |||
ALIAS | |||
) | PARAM_IN(double, ID, DESC, ALIAS, 0.0d, true) |
Define a required double parameter.
The parameter must then be specified on the command line with –ID=value.
ID | Name of the parameter. |
DESC | Quick description of the parameter (1-2 sentences). |
ALIAS | An alias for the parameter (one letter). |
#define PARAM_DOUBLE_OUT | ( | ID, | |
DESC | |||
) | PARAM_OUT(double, ID, DESC, "", 0.0, false) |
Define a double output parameter.
This parameter will be printed on stdout at the end of the program; for instance, if the parameter name is "number" and the value is 5.012, the output on stdout would be of the following form:
If the parameter is not set by the end of the program, a fatal runtime error will be issued.
ID | Name of the parameter. |
DESC | Quick description of the parameter (1-2 sentences). |
#define PARAM_FLAG | ( | ID, | |
DESC, | |||
ALIAS | |||
) | PARAM_IN(bool, ID, DESC, ALIAS, false, false); |
Define a flag parameter.
ID | Name of the parameter. |
DESC | Quick description of the parameter (1-2 sentences). |
ALIAS | An alias for the parameter (one letter). |
#define PARAM_IN | ( | T, | |
ID, | |||
DESC, | |||
ALIAS, | |||
DEF, | |||
REQ | |||
) |
Define an input parameter.
Don't use this function; use the other ones above that call it. Note that we are using the LINE macro for naming these actual parameters when COUNTER does not exist, which is a bit of an ugly hack... but this is the preprocessor, after all. We don't have much choice other than ugliness.
T | Type of the parameter. |
ID | Name of the parameter. |
DESC | Description of the parameter (1-2 sentences). |
ALIAS | Alias for this parameter (one letter). |
DEF | Default value of the parameter. |
REQ | Whether or not parameter is required (boolean value). |
#define PARAM_INT_IN | ( | ID, | |
DESC, | |||
ALIAS, | |||
DEF | |||
) | PARAM_IN(int, ID, DESC, ALIAS, DEF, false) |
Define an integer input parameter.
The parameter can then be specified on the command line with –ID=value.
ID | Name of the parameter. |
DESC | Quick description of the parameter (1-2 sentences). |
ALIAS | An alias for the parameter (one letter). |
DEF | Default value of the parameter. |
#define PARAM_INT_IN_REQ | ( | ID, | |
DESC, | |||
ALIAS | |||
) | PARAM_IN(int, ID, DESC, ALIAS, 0, true) |
Define a required integer input parameter.
The parameter must then be specified on the command line with –ID=value.
ID | Name of the parameter. |
DESC | Quick description of the parameter (1-2 sentences). |
ALIAS | An alias for the parameter (one letter). |
#define PARAM_INT_OUT | ( | ID, | |
DESC | |||
) | PARAM_IN(int, ID, DESC, "", 0, false) |
Define an integer output parameter.
This parameter will be printed on stdout at the end of the program; for instance, if the parameter name is "number" and the value is 5, the output on stdout would be of the following form:
If the parameter is not set by the end of the program, a fatal runtime error will be issued.
ID | Name of the parameter. |
DESC | Quick description of the parameter (1-2 sentences). |
#define PARAM_MATRIX | ( | ID, | |
DESC, | |||
ALIAS, | |||
REQ, | |||
TRANS, | |||
IN | |||
) |
#define PARAM_MATRIX_AND_INFO_IN | ( | ID, | |
DESC, | |||
ALIAS | |||
) | PARAM_IN(TUPLE_TYPE, ID, DESC, ALIAS, TUPLE_TYPE(), false) |
#define PARAM_MATRIX_IN | ( | ID, | |
DESC, | |||
ALIAS | |||
) | PARAM_MATRIX(ID, DESC, ALIAS, false, true, true) |
Define a matrix input parameter.
From the command line, the user can specify the file that holds the matrix, using the name of the matrix parameter with "_file" appended (and the same alias). So for instance, if the name of the matrix parameter was "mat", the user could specify that the "mat" matrix was held in matrix.csv by giving the parameter
ID | Name of the parameter. |
DESC | Description of the parameter (1-2 sentences). |
ALIAS | An alias for the parameter (one letter). |
#define PARAM_MATRIX_IN_REQ | ( | ID, | |
DESC, | |||
ALIAS | |||
) | PARAM_MATRIX(ID, DESC, ALIAS, true, true, true) |
Define a required matrix input parameter.
From the command line, the user can specify the file that holds the matrix, using the name of the matrix parameter with "_file" appended (and the same alias). So for instance, if the name of the matrix parameter was "mat", the user could specify that the "mat" matrix was held in matrix.csv by giving the parameter
ID | Name of the parameter. |
DESC | Description of the parameter (1-2 sentences). |
ALIAS | An alias for the parameter (one letter). |
#define PARAM_MATRIX_OUT | ( | ID, | |
DESC, | |||
ALIAS | |||
) | PARAM_MATRIX(ID, DESC, ALIAS, false, true, false) |
Define a matrix output parameter.
When the program terminates, the matrix will be saved to whatever it was set to by CLI::GetParam<arma::mat>(ID) during the program. From the command-line, the user may specify the file in which to save the output matrix using a string option that is the name of the matrix parameter with "_file" appended. So, for instance, if the name of the output matrix parameter was "mat", the user could speicfy that the "mat" matrix should be saved in matrix.csv by giving the parameter
The output matrix will not be printed on stdout, like the other output option types.
ID | Name of the parameter. |
DESC | Description of the parameter (1-2 sentences). |
ALIAS | An alias for the parameter (one letter). |
#define PARAM_MODEL | ( | TYPE, | |
ID, | |||
DESC, | |||
ALIAS, | |||
REQ, | |||
IN | |||
) |
#define PARAM_MODEL_IN | ( | TYPE, | |
ID, | |||
DESC, | |||
ALIAS | |||
) | PARAM_MODEL(TYPE, ID, DESC, ALIAS, false, true) |
Define an input model.
From the command line, the user can specify the file that holds the model, using the name of the model parameter with "_file" appended (and the same alias). So for instance, if the name of the model parameter was "model", the user could specify that the "model" model was held in model.bin by giving the parameter
Note that the first parameter of this model is the type (the class name) of the model to be loaded. This model type must have a Serialize() function; a compilation error (a very long and complex one) will result if the model type does not have the following function:
This is the boost::serialization serialize() function, just with a capital s for Serialize() (see src/mlpack/core/data/serialization_shim.hpp).
TYPE | Type of the model to be loaded. |
ID | Name of the parameter. |
DESC | Description of the parameter. |
ALIAS | An alias for the parameter (one letter). |
#define PARAM_MODEL_IN_REQ | ( | TYPE, | |
ID, | |||
DESC, | |||
ALIAS | |||
) | PARAM_MODEL(TYPE, ID, DESC, ALIAS, true, true) |
Define a required input model.
From the command line, the user can specify the file that holds the model, using the name of the model parameter with "_file" appended (and the same alias). So for instance, if the name of the model parameter was "model", the user could specify that the "model" model was held in model.bin by giving the parameter
Note that the first parameter of this model is the type (the class name) of the model to be loaded. This model type must have a Serialize() function; a compilation error (a very long and complex one) will result if the model type does not have the following function:
This is the boost::serialization serialize() function, just with a capital s for Serialize() (see src/mlpack/core/data/serialization_shim.hpp).
TYPE | Type of the model to be loaded. |
ID | Name of the parameter. |
DESC | Description of the parameter. |
ALIAS | An alias for the parameter (one letter). |
#define PARAM_MODEL_OUT | ( | TYPE, | |
ID, | |||
DESC, | |||
ALIAS | |||
) | PARAM_MODEL(TYPE, ID, DESC, ALIAS, false, false) |
Define an output model.
From the command line, the user can specify the file that should hold the model, using the name of the model parameter with "_file" appended (and the same alias). So for instance, if the user desires to save the model to model.bin and the parameter name is "model", they could specify
The model will be saved at the termination of the program. If you use a parameter of this type, you must call CLI::Destroy() at the end of your program.
TYPE | Type of the model to be saved. |
ID | Name of the parameter. |
DESC | Description of the parameter. |
ALIAS | An alias for the parameter (one letter). |
#define PARAM_OUT | ( | T, | |
ID, | |||
DESC, | |||
ALIAS, | |||
DEF, | |||
REQ | |||
) |
#define PARAM_STRING_IN | ( | ID, | |
DESC, | |||
ALIAS, | |||
DEF | |||
) | PARAM_IN(std::string, ID, DESC, ALIAS, DEF, false) |
Define a string input parameter.
The parameter can then be specified on the command line with –ID=value. If ALIAS is equal to DEF_MOD (which is set using the PROGRAM_INFO() macro), the parameter can be specified with just –ID=value.
ID | Name of the parameter. |
DESC | Quick description of the parameter (1-2 sentences). |
ALIAS | An alias for the parameter (one letter). |
DEF | Default value of the parameter. |
#define PARAM_STRING_IN_REQ | ( | ID, | |
DESC, | |||
ALIAS | |||
) | PARAM_IN(std::string, ID, DESC, ALIAS, "", true) |
Define a required string parameter.
The parameter must then be specified on the command line with –ID=value.
ID | Name of the parameter. |
DESC | Quick description of the parameter (1-2 sentences). |
ALIAS | An alias for the parameter (one letter). |
#define PARAM_STRING_OUT | ( | ID, | |
DESC, | |||
ALIAS | |||
) | PARAM_OUT(std::string, ID, DESC, ALIAS, "", false) |
Define a string output parameter.
The string will be printed to stdout at the end of the program. For instance, if there was a string output parameter called "something" with value "hello", at the end of the program the output would be of the following form:
ID | Name of the parameter. |
DESC | Quick description of the parameter (1-2 sentences). |
ALIAS | An alias for the parameter (one letter). |
#define PARAM_TMATRIX_IN | ( | ID, | |
DESC, | |||
ALIAS | |||
) | PARAM_MATRIX(ID, DESC, ALIAS, false, false, true) |
Define a transposed matrix input parameter.
This is useful when data is desired in row-major form instead of the usual column-major form. From the command line, the user can specify the file that holds the matrix, using the name of the matrix parameter with "_file" appended (and the same alias). So for instance, if the name of the matrix parameter was "mat", the user could specify that the "mat" matrix was held in matrix.csv by giving the parameter
ID | Name of the parameter. |
DESC | Description of the parameter (1-2 sentences). |
ALIAS | An alias for the parameter (one letter). |
#define PARAM_TMATRIX_IN_REQ | ( | ID, | |
DESC, | |||
ALIAS | |||
) | PARAM_MATRIX(ID, DESC, ALIAS, true, false, true) |
Define a required transposed matrix input parameter.
This is useful when data is desired in row-major form instead of the usual column-major form. From the command line, the user can specify the file that holds the matrix, using the name of the matrix parameter with "_file" appended (and the same alias). So for instance, if the name of the matrix parameter was "mat", the user could specify that the "mat" matrix was held in matrix.csv by giving the parameter
ID | Name of the parameter. |
DESC | Description of the parameter (1-2 sentences). |
ALIAS | An alias for the parameter (one letter). |
#define PARAM_TMATRIX_OUT | ( | ID, | |
DESC, | |||
ALIAS | |||
) | PARAM_MATRIX(ID, DESC, ALIAS, false, false, false) |
Define a transposed matrix output parameter.
This is useful when data is stored in a row-major form instead of the usual column-major form. When the program terminates, the matrix will be saved to whatever it was set to by CLI::GetParam<arma::mat>(ID) during the program. From the command-line, the user may specify the file in which to save the output matrix using a string option that is the name of the matrix parameter with "_file" appended. So, for instance, if the name of the output matrix parameter was "mat", the user could speicfy that the "mat" matrix should be saved in matrix.csv by giving the parameter
The output matrix will not be printed on stdout, like the other output option types.
ID | Name of the parameter. |
DESC | Description of the parameter (1-2 sentences). |
ALIAS | An alias for the parameter (one letter). |
#define PARAM_UMATRIX | ( | ID, | |
DESC, | |||
ALIAS, | |||
REQ, | |||
TRANS, | |||
IN | |||
) |
#define PARAM_UMATRIX_IN | ( | ID, | |
DESC, | |||
ALIAS | |||
) | PARAM_UMATRIX(ID, DESC, ALIAS, false, true, true) |
Define an unsigned matrix input parameter (arma::Mat<size_t>).
From the command line, the user can specify the file that holds the matrix, using the name of the matrix parameter with "_file" appended (and the same alias). So for instance, if the name of the matrix parameter was "mat", the user could specify that the "mat" matrix was held in matrix.csv by giving the parameter
ID | Name of the parameter. |
DESC | Description of the parameter (1-2 sentences). |
ALIAS | An alias for the parameter (one letter). |
#define PARAM_UMATRIX_IN_REQ | ( | ID, | |
DESC, | |||
ALIAS | |||
) | PARAM_UMATRIX(ID, DESC, ALIAS, true, true, true) |
Define a required unsigned matrix input parameter (arma::Mat<size_t>).
From the command line, the user can specify the file that holds the matrix, using the name of the matrix parameter with "_file" appended (and the same alias). So for instance, if the name of the matrix parameter was "mat", the user could specify that the "mat" matrix was held in matrix.csv by giving the parameter
ID | Name of the parameter. |
DESC | Description of the parameter (1-2 sentences). |
ALIAS | An alias for the parameter (one letter). |
#define PARAM_UMATRIX_OUT | ( | ID, | |
DESC, | |||
ALIAS | |||
) | PARAM_UMATRIX(ID, DESC, ALIAS, false, true, false) |
Define an unsigned matrix output parameter (arma::Mat<size_t>).
When the program terminates, the matrix will be saved to whatever it was set to by CLI::GetParam<arma::Mat<size_t>>(ID) during the program. From the command-line, the user may specify the file in which to save the output matrix using a string option that is the name of the matrix parameter with "_file" appended. So, for instance, if the name of the output matrix parameter was "mat", the user could speicfy that the "mat" matrix should be saved in matrix.csv by giving the parameter
The output matrix will not be printed on stdout, like the other output option types.
ID | Name of the parameter. |
DESC | Description of the parameter (1-2 sentences). |
ALIAS | An alias for the parameter (one letter). |
#define PARAM_VECTOR_IN | ( | T, | |
ID, | |||
DESC, | |||
ALIAS | |||
) | PARAM_IN(std::vector<T>, ID, DESC, ALIAS, std::vector<T>(), false) |
Define a vector input parameter.
The parameter can then be specified on the command line with –ID=value1,value2,value3.
ID | Name of the parameter. |
DESC | Quick description of the parameter (1-2 sentences). |
ALIAS | An alias for the parameter (one letter). |
DEF | Default value of the parameter. |
#define PARAM_VECTOR_IN_REQ | ( | T, | |
ID, | |||
DESC, | |||
ALIAS | |||
) | PARAM_IN(std::vector<T>, ID, DESC, ALIAS, std::vector<T>(), true); |
Define a required vector parameter.
The parameter must then be specified on the command line with –ID=value1,value2,value3.
ID | Name of the parameter. |
DESC | Quick description of the parameter (1-2 sentences). |
ALIAS | An alias for the parameter (one letter). |
#define PARAM_VECTOR_OUT | ( | T, | |
ID | |||
) | PARAM_OUT(std::vector<T>, ID, DESC, "", std::vector<T>(), false) |
Define a vector output parameter.
This vector will be printed on stdout at the end of the program; for instance, if the parameter name is "vector" and the vector holds the array { 1, 2, 3, 4 }, the output on stdout would be of the following form:
If the parameter is not set by the end of the program, a fatal runtime error will be issued.
ID | Name of the parameter. |
DESC | Quick description of the parameter (1-2 sentences). |
#define PROGRAM_INFO | ( | NAME, | |
DESC | |||
) |
Document an executable.
Only one instance of this macro should be present in your program! Therefore, use it in the main.cpp (or corresponding executable) in your program.
NAME | Short string representing the name of the program. |
DESC | Long string describing what the program does and possibly a simple usage example. Newlines should not be used here; this is taken care of by CLI (however, you can explicitly specify newlines to denote new paragraphs). |
#define TUPLE_TYPE std::tuple<mlpack::data::DatasetInfo, arma::mat> |
Define an input DatasetInfo/matrix parameter.
From the command line, the user can specify the file that holds the matrix, using the name of the matrix parameter with "_file" appended (and the same alias). So for instance, if the name of the matrix parameter was "matrix", the user could specify that the "matrix" matrix was held in file.csv by giving the parameter
Then the DatasetInfo and matrix type could be accessed with
ID | Name of the parameter. |
DESC | Quick description of the parameter (1-2 sentences). |
ALIAS | One-character string representing the alias of the parameter. |