mlpack  master
mlpack::bindings::cli Namespace Reference

Classes

class  CLIOption
 A static object whose constructor registers a parameter with the CLI class. More...

 
struct  ParameterType
 Utility struct to return the type that boost::program_options should accept for a given input type. More...

 
struct  ParameterType< arma::Col< eT > >
 For vector types, boost::program_options will accept a std::string, not an arma::Col<eT> (since it is not clear how to specify a vector on the command-line). More...

 
struct  ParameterType< arma::Mat< eT > >
 For matrix types, boost::program_options will accept a std::string, not an arma::mat (since it is not clear how to specify a matrix on the command-line). More...

 
struct  ParameterType< arma::Row< eT > >
 For row vector types, boost::program_options will accept a std::string, not an arma::Row<eT> (since it is not clear how to specify a vector on the command-line). More...

 
struct  ParameterType< std::tuple< mlpack::data::DatasetMapper< PolicyType, std::string >, arma::Mat< eT > > >
 For matrix+dataset info types, we should accept a std::string. More...

 
struct  ParameterTypeDeducer
 
struct  ParameterTypeDeducer< true, T >
 
class  ProgramDoc
 A static object whose constructor registers program documentation with the CLI class. More...

 

Functions

template
<
typename
T
>
void AddToPO (const std::string &boostName, const std::string &descr, boost::program_options::options_description &desc, const typename boost::disable_if< util::IsStdVector< T >>::type *=0, const typename boost::disable_if< std::is_same< T, bool >>::type *=0)
 Add a non-vector option to boost::program_options. More...

 
template
<
typename
T
>
void AddToPO (const std::string &boostName, const std::string &descr, boost::program_options::options_description &desc, const typename boost::enable_if< util::IsStdVector< T >>::type *=0, const typename boost::disable_if< std::is_same< T, bool >>::type *=0)
 Add a vector option to boost::program_options. More...

 
template
<
typename
T
>
void AddToPO (const std::string &boostName, const std::string &descr, boost::program_options::options_description &desc, const typename boost::disable_if< util::IsStdVector< T >>::type *=0, const typename boost::enable_if< std::is_same< T, bool >>::type *=0)
 Add a boolean option to boost::program_options. More...

 
template
<
typename
T
>
void AddToPO (const util::ParamData &d, const void *, void *output)
 Add an option to boost::program_options. More...

 
template
<
typename
T
>
void DefaultParam (const util::ParamData &data, const void *, void *output)
 Return the default value of an option. More...

 
template
<
typename
T
>
std::string DefaultParamImpl (const util::ParamData &data, const typename boost::disable_if< arma::is_arma_type< T >>::type *=0, const typename boost::disable_if< util::IsStdVector< T >>::type *=0, const typename boost::disable_if< data::HasSerialize< T >>::type *=0, const typename boost::disable_if< std::is_same< T, std::string >>::type *=0, const typename boost::disable_if< std::is_same< T, std::tuple< mlpack::data::DatasetInfo, arma::mat >>>::type *=0)
 Return the default value of an option. More...

 
template
<
typename
T
>
std::string DefaultParamImpl (const util::ParamData &data, const typename boost::enable_if< util::IsStdVector< T >>::type *=0)
 Return the default value of a vector option. More...

 
template
<
typename
T
>
std::string DefaultParamImpl (const util::ParamData &data, const typename boost::enable_if< std::is_same< T, std::string >>::type *=0)
 Return the default value of a string option. More...

 
template
<
typename
T
>
std::string DefaultParamImpl (const util::ParamData &data, const typename boost::enable_if_c< arma::is_arma_type< T >::value||data::HasSerialize< T >::value||std::is_same< T, std::tuple< mlpack::data::DatasetInfo, arma::mat >>::value >::type *=0)
 Return the default value of a matrix option, a tuple option, a serializable option, or a string option (this returns the default filename, or '' if the default is no file). More...

 
void EndProgram ()
 Handle command-line program termination. More...

 
template
<
typename
T
>
T & GetParam (util::ParamData &d, const typename boost::disable_if< arma::is_arma_type< T >>::type *=0, const typename boost::disable_if< data::HasSerialize< T >>::type *=0, const typename boost::disable_if< std::is_same< T, std::tuple< mlpack::data::DatasetInfo, arma::mat >>>::type *=0)
 This overload is called when nothing special needs to happen to the name of the parameter. More...

 
template
<
typename
T
>
T & GetParam (util::ParamData &d, const typename boost::enable_if< arma::is_arma_type< T >>::type *=0)
 Return a matrix parameter. More...

 
template
<
typename
T
>
T & GetParam (util::ParamData &d, const typename boost::enable_if< std::is_same< T, std::tuple< mlpack::data::DatasetInfo, arma::mat >>>::type *=0)
 Return a matrix/dataset info parameter. More...

 
template
<
typename
T
>
T & GetParam (util::ParamData &d, const typename boost::enable_if< data::HasSerialize< T >>::type *=0)
 Return a serializable object. More...

 
template
<
typename
T
>
void GetParam (const util::ParamData &d, const void *, void *output)
 Return a parameter casted to the given type. More...

 
template
<
typename
T
>
std::string GetPrintableParam (const util::ParamData &data, const typename boost::disable_if< arma::is_arma_type< T >>::type *=0, const typename boost::disable_if< util::IsStdVector< T >>::type *=0, const typename boost::disable_if< data::HasSerialize< T >>::type *=0, const typename boost::disable_if< std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>>::type *=0)
 Print an option. More...

 
template
<
typename
T
>
std::string GetPrintableParam (const util::ParamData &data, const typename std::enable_if< util::IsStdVector< T >::value >::type *=0)
 Print a vector option, with spaces between it. More...

 
template
<
typename
T
>
std::string GetPrintableParam (const util::ParamData &data, const typename std::enable_if< arma::is_arma_type< T >::value||data::HasSerialize< T >::value||std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>::value >::type *=0)
 Print a matrix option (this just prints the filename). More...

 
template
<
typename
T
>
void GetPrintableParam (const util::ParamData &data, const void *, void *output)
 Print an option into a std::string. More...

 
template
<
typename
T
>
std::string GetPrintableParamName (const util::ParamData &data, const typename boost::disable_if< arma::is_arma_type< T >>::type *=0, const typename boost::disable_if< data::HasSerialize< T >>::type *=0, const typename boost::disable_if< std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>>::type *=0)
 Get the parameter name for a type that has no special handling. More...

 
template
<
typename
T
>
std::string GetPrintableParamName (const util::ParamData &data, const typename boost::enable_if< arma::is_arma_type< T >>::type *=0)
 Get the parameter name for a matrix type (where the user has to pass the file that holds the matrix). More...

 
template
<
typename
T
>
std::string GetPrintableParamName (const util::ParamData &data, const typename boost::enable_if< data::HasSerialize< T >>::type *=0)
 Get the parameter name for a serializable model type (where the user has to pass the file that holds the matrix). More...

 
template
<
typename
T
>
std::string GetPrintableParamName (const util::ParamData &data, const typename boost::enable_if< std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>>::type *=0)
 Get the parameter name for a mapped matrix type (where the user has to pass the file that holds the matrix). More...

 
template
<
typename
T
>
void GetPrintableParamName (const util::ParamData &d, const void *, void *output)
 Get the parameter's name as seen by the user. More...

 
template
<
typename
T
>
std::string GetPrintableParamValue (const util::ParamData &data, const std::string &value, const typename boost::disable_if< arma::is_arma_type< T >>::type *=0, const typename boost::disable_if< data::HasSerialize< T >>::type *=0, const typename boost::disable_if< std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>>::type *=0)
 Get the parameter name for a type that has no special handling. More...

 
template
<
typename
T
>
std::string GetPrintableParamValue (const util::ParamData &data, const std::string &value, const typename boost::enable_if< arma::is_arma_type< T >>::type *=0)
 Get the parameter name for a matrix type (where the user has to pass the file that holds the matrix). More...

 
template
<
typename
T
>
std::string GetPrintableParamValue (const util::ParamData &data, const std::string &value, const typename boost::enable_if< data::HasSerialize< T >>::type *=0)
 Get the parameter name for a serializable model type (where the user has to pass the file that holds the matrix). More...

 
template
<
typename
T
>
std::string GetPrintableParamValue (const util::ParamData &data, const std::string &value, const typename boost::enable_if< std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>>::type *=0)
 Get the parameter name for a mapped matrix type (where the user has to pass the file that holds the matrix). More...

 
template
<
typename
T
>
void GetPrintableParamValue (const util::ParamData &d, const void *input, void *output)
 Get the parameter's name as seen by the user. More...

 
template
<
typename
T
>
T & GetRawParam (util::ParamData &d, const typename boost::disable_if< arma::is_arma_type< T >>::type *=0, const typename boost::disable_if< data::HasSerialize< T >>::type *=0, const typename boost::disable_if< std::is_same< T, std::tuple< mlpack::data::DatasetInfo, arma::mat >>>::type *=0)
 This overload is called when nothing special needs to happen to the name of the parameter. More...

 
template
<
typename
T
>
T & GetRawParam (util::ParamData &d, const typename boost::enable_if_c< arma::is_arma_type< T >::value||std::is_same< T, std::tuple< mlpack::data::DatasetInfo, arma::mat >>::value||data::HasSerialize< T >::value >::type *=0)
 Return a matrix parameter. More...

 
template
<
typename
T
>
void GetRawParam (const util::ParamData &d, const void *, void *output)
 Return a parameter casted to the given type. More...

 
template
<
typename
T
>
std::string MapParameterName (const std::string &identifier, const typename boost::disable_if< arma::is_arma_type< T >>::type *=0, const typename boost::disable_if< data::HasSerialize< T >>::type *=0, const typename boost::disable_if< std::is_same< T, std::tuple< mlpack::data::DatasetInfo, arma::mat >>>::type *=0)
 If needed, map the parameter name to the name that is used by boost::program_options. More...

 
template
<
typename
T
>
std::string MapParameterName (const std::string &identifier, const typename boost::enable_if_c< arma::is_arma_type< T >::value||std::is_same< T, std::tuple< mlpack::data::DatasetInfo, arma::mat >>::value||data::HasSerialize< T >::value >::type *=0)
 Map the parameter name to the name that is used by boost::program_options. More...

 
template
<
typename
T
>
void MapParameterName (const util::ParamData &d, const void *, void *output)
 Map the parameter name to the name seen by boost::program_options. More...

 
template
<
typename
T
>
void OutputParam (const util::ParamData &data, const void *, void *)
 Output an option. More...

 
template
<
typename
T
>
void OutputParamImpl (const util::ParamData &data, const typename boost::disable_if< arma::is_arma_type< T >>::type *=0, const typename boost::disable_if< util::IsStdVector< T >>::type *=0, const typename boost::disable_if< data::HasSerialize< T >>::type *=0, const typename boost::disable_if< std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>>::type *=0)
 Output an option (print to stdout). More...

 
template
<
typename
T
>
void OutputParamImpl (const util::ParamData &data, const typename boost::enable_if< util::IsStdVector< T >>::type *=0)
 Output a vector option (print to stdout). More...

 
template
<
typename
T
>
void OutputParamImpl (const util::ParamData &data, const typename boost::enable_if< arma::is_arma_type< T >>::type *=0)
 Output a matrix option (this saves it to the given file). More...

 
template
<
typename
T
>
void OutputParamImpl (const util::ParamData &data, const typename boost::enable_if< data::HasSerialize< T >>::type *=0)
 Output a serializable class option (this saves it to the given file). More...

 
template
<
typename
T
>
void OutputParamImpl (const util::ParamData &data, const typename boost::enable_if< std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>>::type *=0)
 Output a mapped dataset. More...

 
 PARAM_FLAG ("help", "Default help info.", "h")
 
 PARAM_FLAG ("verbose", "Display informational messages and the full list of " "parameters and timers at the end of execution.", "v")
 
 PARAM_FLAG ("version", "Display the version of mlpack.", "V")
 
 PARAM_STRING_IN ("info", "Get help on a specific module or option.", "", "")
 
std::string ParamString (const std::string &paramName)
 Print what a user would type to invoke the given option name. More...

 
void ParseCommandLine (int argc, char **argv)
 Parse the command line, setting all of the options inside of the CLI object to their appropriate given values. More...

 
std::string PrintDataset (const std::string &dataset)
 Print a dataset type parameter (add .csv and return). More...

 
void PrintHelp (const std::string &param="")
 Print the help for the given parameter. More...

 
std::string PrintModel (const std::string &model)
 Print a model type parameter (add .bin and return). More...

 
template
<
typename
T
>
std::string PrintValue (const T &value, bool quotes)
 Given a parameter type, print the corresponding value. More...

 
std::string ProcessOptions ()
 Base case for recursion. More...

 
template<typename T , typename... Args>
std::string ProcessOptions (const std::string &paramName, const T &value, Args... args)
 Print an option for a command-line argument. More...

 
template<typename... Args>
std::string ProgramCall (const std::string &programName, Args... args)
 Given a program name and arguments for it, print what its invocation would be. More...

 
template
<
typename
T
>
void SetParam (util::ParamData &d, const boost::any &value, const typename boost::disable_if< arma::is_arma_type< T >>::type *=0, const typename boost::disable_if< data::HasSerialize< T >>::type *=0, const typename boost::disable_if< std::is_same< T, std::tuple< mlpack::data::DatasetInfo, arma::mat >>>::type *=0, const typename boost::disable_if< std::is_same< T, bool >>::type *=0)
 This overload is called when nothing special needs to happen to the name of the parameter. More...

 
template
<
typename
T
>
void SetParam (util::ParamData &d, const boost::any &, const typename boost::enable_if< std::is_same< T, bool >>::type *=0)
 This overload is called to set a boolean. More...

 
template
<
typename
T
>
void SetParam (util::ParamData &d, const boost::any &value, const typename std::enable_if< arma::is_arma_type< T >::value||data::HasSerialize< T >::value||std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>::value >::type *=0)
 Set a matrix parameter, a matrix/dataset info parameter, or a serializable object. More...

 
template
<
typename
T
>
void SetParam (const util::ParamData &d, const void *input, void *)
 Return a parameter casted to the given type. More...

 
template
<
typename
T
>
void StringTypeParam (const util::ParamData &, const void *, void *output)
 Return a string containing the type of a parameter. More...

 
template
<
>
void StringTypeParam< bool > (const util::ParamData &, const void *, void *output)
 Return "bool". More...

 
template
<
>
void StringTypeParam< double > (const util::ParamData &, const void *, void *output)
 Return "double". More...

 
template
<
>
void StringTypeParam< float > (const util::ParamData &, const void *, void *output)
 Return "float". More...

 
template
<
>
void StringTypeParam< int > (const util::ParamData &, const void *, void *output)
 Return "int". More...

 
template
<
>
void StringTypeParam< std::string > (const util::ParamData &, const void *, void *output)
 Return "string". More...

 
template
<
>
void StringTypeParam< std::tuple< mlpack::data::DatasetInfo, arma::mat > > (const util::ParamData &, const void *, void *output)
 Return "string";. More...

 
template
<
typename
T
>
std::string StringTypeParamImpl (const typename boost::disable_if< arma::is_arma_type< T >>::type *=0, const typename boost::disable_if< util::IsStdVector< T >>::type *=0, const typename boost::disable_if< data::HasSerialize< T >>::type *=0)
 Return a string containing the type of the parameter. More...

 
template
<
typename
T
>
std::string StringTypeParamImpl (const typename boost::enable_if< util::IsStdVector< T >>::type *=0)
 Return a string containing the type of the parameter, for vector options. More...

 
template
<
typename
T
>
std::string StringTypeParamImpl (const typename boost::enable_if< arma::is_arma_type< T >>::type *=0)
 Return a string containing the type of the parameter, for matrix options. More...

 
template
<
typename
T
>
std::string StringTypeParamImpl (const typename boost::enable_if< data::HasSerialize< T >>::type *=0)
 Return a string containing the type of the parameter,. More...

 

Function Documentation

◆ AddToPO() [1/4]

void mlpack::bindings::cli::AddToPO ( const std::string boostName,
const std::string descr,
boost::program_options::options_description &  desc,
const typename boost::disable_if< util::IsStdVector< T >>::type *  = 0,
const typename boost::disable_if< std::is_same< T, bool >>::type *  = 0 
)

Add a non-vector option to boost::program_options.

Parameters
boostNameThe name of the option to add to boost::program_options.
descrDescription string for parameter.
descOptions description to add parameter to.

Definition at line 28 of file add_to_po.hpp.

◆ AddToPO() [2/4]

void mlpack::bindings::cli::AddToPO ( const std::string boostName,
const std::string descr,
boost::program_options::options_description &  desc,
const typename boost::enable_if< util::IsStdVector< T >>::type *  = 0,
const typename boost::disable_if< std::is_same< T, bool >>::type *  = 0 
)

Add a vector option to boost::program_options.

This overload will use the multitoken() option.

Parameters
boostNameThe name of the option to add to boost::program_options.
descrDescription string for parameter.
descOptions description to add parameter to.

Definition at line 47 of file add_to_po.hpp.

◆ AddToPO() [3/4]

void mlpack::bindings::cli::AddToPO ( const std::string boostName,
const std::string descr,
boost::program_options::options_description &  desc,
const typename boost::disable_if< util::IsStdVector< T >>::type *  = 0,
const typename boost::enable_if< std::is_same< T, bool >>::type *  = 0 
)

Add a boolean option to boost::program_options.

Parameters
boostNameThe name of the option to add to boost::program_options.
descrDescription string for parameter.
descOptions description to add parameter to.

Definition at line 65 of file add_to_po.hpp.

◆ AddToPO() [4/4]

void mlpack::bindings::cli::AddToPO ( const util::ParamData d,
const void *  ,
void *  output 
)

Add an option to boost::program_options.

This is the function meant to be used in the CLI function map.

Parameters
dParameter data.
inputUnused void pointer.
outputVoid pointer to options_description object.

Definition at line 83 of file add_to_po.hpp.

References ParamData::alias, ParamData::desc, ParamData::name, and string().

◆ DefaultParam()

void mlpack::bindings::cli::DefaultParam ( const util::ParamData data,
const void *  ,
void *  output 
)

Return the default value of an option.

This is the function that will be placed into the CLI functionMap.

Definition at line 66 of file default_param.hpp.

References string().

◆ DefaultParamImpl() [1/4]

std::string mlpack::bindings::cli::DefaultParamImpl ( const util::ParamData data,
const typename boost::disable_if< arma::is_arma_type< T >>::type *  = 0,
const typename boost::disable_if< util::IsStdVector< T >>::type *  = 0,
const typename boost::disable_if< data::HasSerialize< T >>::type *  = 0,
const typename boost::disable_if< std::is_same< T, std::string >>::type *  = 0,
const typename boost::disable_if< std::is_same< T, std::tuple< mlpack::data::DatasetInfo, arma::mat >>>::type *  = 0 
)

Return the default value of an option.

This is for regular types.

◆ DefaultParamImpl() [2/4]

std::string mlpack::bindings::cli::DefaultParamImpl ( const util::ParamData data,
const typename boost::enable_if< util::IsStdVector< T >>::type *  = 0 
)

Return the default value of a vector option.

◆ DefaultParamImpl() [3/4]

std::string mlpack::bindings::cli::DefaultParamImpl ( const util::ParamData data,
const typename boost::enable_if< std::is_same< T, std::string >>::type *  = 0 
)

Return the default value of a string option.

◆ DefaultParamImpl() [4/4]

std::string mlpack::bindings::cli::DefaultParamImpl ( const util::ParamData data,
const typename boost::enable_if_c< arma::is_arma_type< T >::value||data::HasSerialize< T >::value||std::is_same< T, std::tuple< mlpack::data::DatasetInfo, arma::mat >>::value >::type *  = 0 
)

Return the default value of a matrix option, a tuple option, a serializable option, or a string option (this returns the default filename, or '' if the default is no file).

◆ EndProgram()

void mlpack::bindings::cli::EndProgram ( )
inline

Handle command-line program termination.

If –help or –info was passed, we won't make it here, so we don't have to write any contingencies for that.

Definition at line 21 of file end_program.hpp.

References CLI::functionMap, Timers::GetAllTimers(), CLI::GetSingleton(), CLI::HasParam(), Log::Info, ParamData::input, CLI::Parameters(), Timers::PrintTimer(), CLI::StopTimers(), string(), CLI::timer, and ParamData::tname.

◆ GetParam() [1/5]

T& mlpack::bindings::cli::GetParam ( util::ParamData d,
const typename boost::disable_if< arma::is_arma_type< T >>::type *  = 0,
const typename boost::disable_if< data::HasSerialize< T >>::type *  = 0,
const typename boost::disable_if< std::is_same< T, std::tuple< mlpack::data::DatasetInfo, arma::mat >>>::type *  = 0 
)

This overload is called when nothing special needs to happen to the name of the parameter.

Parameters
dParamData object to get parameter value from.

Definition at line 24 of file get_param.hpp.

References ParamData::value.

◆ GetParam() [2/5]

T& mlpack::bindings::cli::GetParam ( util::ParamData d,
const typename boost::enable_if< arma::is_arma_type< T >>::type *  = 0 
)

Return a matrix parameter.

Parameters
dParamData object to get parameter value from.

Definition at line 41 of file get_param.hpp.

References ParamData::input, mlpack::data::Load(), ParamData::loaded, ParamData::noTranspose, string(), and ParamData::value.

◆ GetParam() [3/5]

T& mlpack::bindings::cli::GetParam ( util::ParamData d,
const typename boost::enable_if< std::is_same< T, std::tuple< mlpack::data::DatasetInfo, arma::mat >>>::type *  = 0 
)

Return a matrix/dataset info parameter.

Parameters
dParamData object to get parameter value from.

Definition at line 72 of file get_param.hpp.

References ParamData::input, mlpack::data::Load(), ParamData::loaded, ParamData::noTranspose, string(), and ParamData::value.

◆ GetParam() [4/5]

T& mlpack::bindings::cli::GetParam ( util::ParamData d,
const typename boost::enable_if< data::HasSerialize< T >>::type *  = 0 
)

Return a serializable object.

Parameters
dParamData object to get parameter value from.

Definition at line 98 of file get_param.hpp.

References ParamData::input, mlpack::data::Load(), ParamData::loaded, string(), and ParamData::value.

◆ GetParam() [5/5]

void mlpack::bindings::cli::GetParam ( const util::ParamData d,
const void *  ,
void *  output 
)

Return a parameter casted to the given type.

Type checking does not happen here!

Parameters
dParameter information.
inputUnused parameter.
outputPlace to store pointer to value.

Definition at line 126 of file get_param.hpp.

◆ GetPrintableParam() [1/4]

std::string mlpack::bindings::cli::GetPrintableParam ( const util::ParamData data,
const typename boost::disable_if< arma::is_arma_type< T >>::type *  = 0,
const typename boost::disable_if< util::IsStdVector< T >>::type *  = 0,
const typename boost::disable_if< data::HasSerialize< T >>::type *  = 0,
const typename boost::disable_if< std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>>::type *  = 0 
)

Print an option.

Print an option.

Definition at line 21 of file get_printable_param.hpp.

◆ GetPrintableParam() [2/4]

std::string mlpack::bindings::cli::GetPrintableParam ( const util::ParamData data,
const typename std::enable_if< util::IsStdVector< T >::value >::type *  = 0 
)

Print a vector option, with spaces between it.

◆ GetPrintableParam() [3/4]

std::string mlpack::bindings::cli::GetPrintableParam ( const util::ParamData data,
const typename std::enable_if< arma::is_arma_type< T >::value||data::HasSerialize< T >::value||std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>::value >::type *  = 0 
)

Print a matrix option (this just prints the filename).

◆ GetPrintableParam() [4/4]

void mlpack::bindings::cli::GetPrintableParam ( const util::ParamData data,
const void *  ,
void *  output 
)

Print an option into a std::string.

This should print a short, one-line representation of the object. The string will be stored in the output pointer.

Definition at line 56 of file get_printable_param.hpp.

References string().

◆ GetPrintableParamName() [1/5]

std::string mlpack::bindings::cli::GetPrintableParamName ( const util::ParamData data,
const typename boost::disable_if< arma::is_arma_type< T >>::type *  = 0,
const typename boost::disable_if< data::HasSerialize< T >>::type *  = 0,
const typename boost::disable_if< std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>>::type *  = 0 
)

Get the parameter name for a type that has no special handling.

◆ GetPrintableParamName() [2/5]

std::string mlpack::bindings::cli::GetPrintableParamName ( const util::ParamData data,
const typename boost::enable_if< arma::is_arma_type< T >>::type *  = 0 
)

Get the parameter name for a matrix type (where the user has to pass the file that holds the matrix).

◆ GetPrintableParamName() [3/5]

std::string mlpack::bindings::cli::GetPrintableParamName ( const util::ParamData data,
const typename boost::enable_if< data::HasSerialize< T >>::type *  = 0 
)

Get the parameter name for a serializable model type (where the user has to pass the file that holds the matrix).

◆ GetPrintableParamName() [4/5]

std::string mlpack::bindings::cli::GetPrintableParamName ( const util::ParamData data,
const typename boost::enable_if< std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>>::type *  = 0 
)

Get the parameter name for a mapped matrix type (where the user has to pass the file that holds the matrix).

◆ GetPrintableParamName() [5/5]

void mlpack::bindings::cli::GetPrintableParamName ( const util::ParamData d,
const void *  ,
void *  output 
)

Get the parameter's name as seen by the user.

Definition at line 61 of file get_printable_param_name.hpp.

References string().

◆ GetPrintableParamValue() [1/5]

std::string mlpack::bindings::cli::GetPrintableParamValue ( const util::ParamData data,
const std::string value,
const typename boost::disable_if< arma::is_arma_type< T >>::type *  = 0,
const typename boost::disable_if< data::HasSerialize< T >>::type *  = 0,
const typename boost::disable_if< std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>>::type *  = 0 
)

Get the parameter name for a type that has no special handling.

◆ GetPrintableParamValue() [2/5]

std::string mlpack::bindings::cli::GetPrintableParamValue ( const util::ParamData data,
const std::string value,
const typename boost::enable_if< arma::is_arma_type< T >>::type *  = 0 
)

Get the parameter name for a matrix type (where the user has to pass the file that holds the matrix).

◆ GetPrintableParamValue() [3/5]

std::string mlpack::bindings::cli::GetPrintableParamValue ( const util::ParamData data,
const std::string value,
const typename boost::enable_if< data::HasSerialize< T >>::type *  = 0 
)

Get the parameter name for a serializable model type (where the user has to pass the file that holds the matrix).

◆ GetPrintableParamValue() [4/5]

std::string mlpack::bindings::cli::GetPrintableParamValue ( const util::ParamData data,
const std::string value,
const typename boost::enable_if< std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>>::type *  = 0 
)

Get the parameter name for a mapped matrix type (where the user has to pass the file that holds the matrix).

◆ GetPrintableParamValue() [5/5]

void mlpack::bindings::cli::GetPrintableParamValue ( const util::ParamData d,
const void *  input,
void *  output 
)

Get the parameter's name as seen by the user.

Definition at line 65 of file get_printable_param_value.hpp.

References string().

◆ GetRawParam() [1/3]

T& mlpack::bindings::cli::GetRawParam ( util::ParamData d,
const typename boost::disable_if< arma::is_arma_type< T >>::type *  = 0,
const typename boost::disable_if< data::HasSerialize< T >>::type *  = 0,
const typename boost::disable_if< std::is_same< T, std::tuple< mlpack::data::DatasetInfo, arma::mat >>>::type *  = 0 
)

This overload is called when nothing special needs to happen to the name of the parameter.

Definition at line 23 of file get_raw_param.hpp.

References ParamData::value.

◆ GetRawParam() [2/3]

T& mlpack::bindings::cli::GetRawParam ( util::ParamData d,
const typename boost::enable_if_c< arma::is_arma_type< T >::value||std::is_same< T, std::tuple< mlpack::data::DatasetInfo, arma::mat >>::value||data::HasSerialize< T >::value >::type *  = 0 
)

Return a matrix parameter.

Definition at line 38 of file get_raw_param.hpp.

References ParamData::value.

◆ GetRawParam() [3/3]

void mlpack::bindings::cli::GetRawParam ( const util::ParamData d,
const void *  ,
void *  output 
)

Return a parameter casted to the given type.

Type checking does not happen here!

Parameters
dParameter information.
inputUnused parameter.
outputPlace to store pointer to value.

Definition at line 61 of file get_raw_param.hpp.

◆ MapParameterName() [1/3]

std::string mlpack::bindings::cli::MapParameterName ( const std::string identifier,
const typename boost::disable_if< arma::is_arma_type< T >>::type *  = 0,
const typename boost::disable_if< data::HasSerialize< T >>::type *  = 0,
const typename boost::disable_if< std::is_same< T, std::tuple< mlpack::data::DatasetInfo, arma::mat >>>::type *  = 0 
)

If needed, map the parameter name to the name that is used by boost::program_options.

This overload simply returns the same name, so it is used for primitive types.

Definition at line 23 of file map_parameter_name.hpp.

◆ MapParameterName() [2/3]

std::string mlpack::bindings::cli::MapParameterName ( const std::string identifier,
const typename boost::enable_if_c< arma::is_arma_type< T >::value||std::is_same< T, std::tuple< mlpack::data::DatasetInfo, arma::mat >>::value||data::HasSerialize< T >::value >::type *  = 0 
)

Map the parameter name to the name that is used by boost::program_options.

This overload addresses matrices and models, where the parameter name has "_file" appended to it (since a filename will be provided).

Definition at line 39 of file map_parameter_name.hpp.

◆ MapParameterName() [3/3]

void mlpack::bindings::cli::MapParameterName ( const util::ParamData d,
const void *  ,
void *  output 
)

Map the parameter name to the name seen by boost::program_options.

Parameters
dParameter data.
inputUnused parameter.
outputPointer to std::string that will hold the mapped name.

Definition at line 58 of file map_parameter_name.hpp.

References ParamData::name, and string().

◆ OutputParam()

void mlpack::bindings::cli::OutputParam ( const util::ParamData data,
const void *  ,
void *   
)

Output an option.

This is the function that will be called by the CLI module.

Definition at line 68 of file output_param.hpp.

◆ OutputParamImpl() [1/5]

void mlpack::bindings::cli::OutputParamImpl ( const util::ParamData data,
const typename boost::disable_if< arma::is_arma_type< T >>::type *  = 0,
const typename boost::disable_if< util::IsStdVector< T >>::type *  = 0,
const typename boost::disable_if< data::HasSerialize< T >>::type *  = 0,
const typename boost::disable_if< std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>>::type *  = 0 
)

Output an option (print to stdout).

◆ OutputParamImpl() [2/5]

void mlpack::bindings::cli::OutputParamImpl ( const util::ParamData data,
const typename boost::enable_if< util::IsStdVector< T >>::type *  = 0 
)

Output a vector option (print to stdout).

◆ OutputParamImpl() [3/5]

void mlpack::bindings::cli::OutputParamImpl ( const util::ParamData data,
const typename boost::enable_if< arma::is_arma_type< T >>::type *  = 0 
)

Output a matrix option (this saves it to the given file).

◆ OutputParamImpl() [4/5]

void mlpack::bindings::cli::OutputParamImpl ( const util::ParamData data,
const typename boost::enable_if< data::HasSerialize< T >>::type *  = 0 
)

Output a serializable class option (this saves it to the given file).

◆ OutputParamImpl() [5/5]

void mlpack::bindings::cli::OutputParamImpl ( const util::ParamData data,
const typename boost::enable_if< std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>>::type *  = 0 
)

Output a mapped dataset.

◆ PARAM_FLAG() [1/3]

mlpack::bindings::cli::PARAM_FLAG ( "help"  ,
"Default help info."  ,
"h"   
)

◆ PARAM_FLAG() [2/3]

mlpack::bindings::cli::PARAM_FLAG ( "verbose"  ,
"Display informational messages and the full list of " "parameters and timers at the end of execution."  ,
"v"   
)

◆ PARAM_FLAG() [3/3]

mlpack::bindings::cli::PARAM_FLAG ( "version"  ,
"Display the version of mlpack."  ,
"V"   
)

◆ PARAM_STRING_IN()

mlpack::bindings::cli::PARAM_STRING_IN ( "info"  ,
"Get help on a specific module or option."  ,
""  ,
""   
)

◆ ParamString()

std::string mlpack::bindings::cli::ParamString ( const std::string paramName)
inline

Print what a user would type to invoke the given option name.

Note that the name must exist in the CLI module. (Note that because of the way ProgramInfo is structured, this doesn't mean that all of the PARAM_*() declarataions need to come before the PROGRAM_INFO() declaration.)

◆ ParseCommandLine()

void mlpack::bindings::cli::ParseCommandLine ( int  argc,
char **  argv 
)

◆ PrintDataset()

std::string mlpack::bindings::cli::PrintDataset ( const std::string dataset)
inline

Print a dataset type parameter (add .csv and return).

◆ PrintHelp()

void mlpack::bindings::cli::PrintHelp ( const std::string param = "")

Print the help for the given parameter.

If no parameter is specified, then help will be printed for all parameters.

Parameters
paramParameter name to print help for.

Referenced by ParseCommandLine().

◆ PrintModel()

std::string mlpack::bindings::cli::PrintModel ( const std::string model)
inline

Print a model type parameter (add .bin and return).

◆ PrintValue()

std::string mlpack::bindings::cli::PrintValue ( const T &  value,
bool  quotes 
)
inline

Given a parameter type, print the corresponding value.

◆ ProcessOptions() [1/2]

std::string mlpack::bindings::cli::ProcessOptions ( )
inline

Base case for recursion.

◆ ProcessOptions() [2/2]

std::string mlpack::bindings::cli::ProcessOptions ( const std::string paramName,
const T &  value,
Args...  args 
)

Print an option for a command-line argument.

◆ ProgramCall()

std::string mlpack::bindings::cli::ProgramCall ( const std::string programName,
Args...  args 
)

Given a program name and arguments for it, print what its invocation would be.

◆ SetParam() [1/4]

void mlpack::bindings::cli::SetParam ( util::ParamData d,
const boost::any &  value,
const typename boost::disable_if< arma::is_arma_type< T >>::type *  = 0,
const typename boost::disable_if< data::HasSerialize< T >>::type *  = 0,
const typename boost::disable_if< std::is_same< T, std::tuple< mlpack::data::DatasetInfo, arma::mat >>>::type *  = 0,
const typename boost::disable_if< std::is_same< T, bool >>::type *  = 0 
)

This overload is called when nothing special needs to happen to the name of the parameter.

Definition at line 22 of file set_param.hpp.

References ParamData::value.

◆ SetParam() [2/4]

void mlpack::bindings::cli::SetParam ( util::ParamData d,
const boost::any &  ,
const typename boost::enable_if< std::is_same< T, bool >>::type *  = 0 
)

This overload is called to set a boolean.

Definition at line 39 of file set_param.hpp.

References ParamData::value, and ParamData::wasPassed.

◆ SetParam() [3/4]

void mlpack::bindings::cli::SetParam ( util::ParamData d,
const boost::any &  value,
const typename std::enable_if< arma::is_arma_type< T >::value||data::HasSerialize< T >::value||std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>::value >::type *  = 0 
)

Set a matrix parameter, a matrix/dataset info parameter, or a serializable object.

These set the filename referring to the parameter.

Definition at line 53 of file set_param.hpp.

References ParamData::value.

◆ SetParam() [4/4]

void mlpack::bindings::cli::SetParam ( const util::ParamData d,
const void *  input,
void *   
)

Return a parameter casted to the given type.

Type checking does not happen here!

Parameters
dParameter information.
inputUnused parameter.
outputPlace to store pointer to value.

Definition at line 76 of file set_param.hpp.

◆ StringTypeParam()

void mlpack::bindings::cli::StringTypeParam ( const util::ParamData ,
const void *  ,
void *  output 
)

Return a string containing the type of a parameter.

This overload is used if we don't have a primitive type.

Definition at line 54 of file string_type_param.hpp.

References string(), StringTypeParam< bool >(), StringTypeParam< double >(), StringTypeParam< float >(), and StringTypeParam< int >().

◆ StringTypeParam< bool >()

void mlpack::bindings::cli::StringTypeParam< bool > ( const util::ParamData ,
const void *  ,
void *  output 
)
inline

Return "bool".

Referenced by StringTypeParam().

◆ StringTypeParam< double >()

void mlpack::bindings::cli::StringTypeParam< double > ( const util::ParamData ,
const void *  ,
void *  output 
)
inline

Return "double".

Referenced by StringTypeParam().

◆ StringTypeParam< float >()

void mlpack::bindings::cli::StringTypeParam< float > ( const util::ParamData ,
const void *  ,
void *  output 
)
inline

Return "float".

Referenced by StringTypeParam().

◆ StringTypeParam< int >()

void mlpack::bindings::cli::StringTypeParam< int > ( const util::ParamData ,
const void *  ,
void *  output 
)
inline

Return "int".

Referenced by StringTypeParam().

◆ StringTypeParam< std::string >()

void mlpack::bindings::cli::StringTypeParam< std::string > ( const util::ParamData ,
const void *  ,
void *  output 
)
inline

Return "string".

◆ StringTypeParam< std::tuple< mlpack::data::DatasetInfo, arma::mat > >()

void mlpack::bindings::cli::StringTypeParam< std::tuple< mlpack::data::DatasetInfo, arma::mat > > ( const util::ParamData ,
const void *  ,
void *  output 
)
inline

Return "string";.

◆ StringTypeParamImpl() [1/4]

std::string mlpack::bindings::cli::StringTypeParamImpl ( const typename boost::disable_if< arma::is_arma_type< T >>::type *  = 0,
const typename boost::disable_if< util::IsStdVector< T >>::type *  = 0,
const typename boost::disable_if< data::HasSerialize< T >>::type *  = 0 
)

Return a string containing the type of the parameter.

◆ StringTypeParamImpl() [2/4]

std::string mlpack::bindings::cli::StringTypeParamImpl ( const typename boost::enable_if< util::IsStdVector< T >>::type *  = 0)

Return a string containing the type of the parameter, for vector options.

◆ StringTypeParamImpl() [3/4]

std::string mlpack::bindings::cli::StringTypeParamImpl ( const typename boost::enable_if< arma::is_arma_type< T >>::type *  = 0)

Return a string containing the type of the parameter, for matrix options.

◆ StringTypeParamImpl() [4/4]

std::string mlpack::bindings::cli::StringTypeParamImpl ( const typename boost::enable_if< data::HasSerialize< T >>::type *  = 0)

Return a string containing the type of the parameter,.