mlpack::bindings::python Namespace Reference

Classes

class  PyOption
 The Python option class. More...

 

Functions

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||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...

 
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::enable_if< data::HasSerialize< T >>::type *=0)
 Return the default value of a model option (this returns the default filename, or '' if the default is no file). More...

 
template
<
typename
T
>
std::string GetArmaType ()
 This is used for arma::Mat<> types; it will return "mat" for matrices, "row" for row vectors, and "col" for column vectors. More...

 
std::string GetBindingName (const std::string &bindingName)
 Given the name of a binding, print its Python name. More...

 
template
<
typename
T
>
std::string GetCythonType (const util::ParamData &, 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< arma::is_arma_type< T >>::type *=0)
 
template
<
typename
T
>
std::string GetCythonType (const util::ParamData &d, const typename boost::enable_if< util::IsStdVector< T >>::type *=0)
 
template
<
typename
T
>
std::string GetCythonType (const util::ParamData &d, const typename boost::enable_if< arma::is_arma_type< T >>::type *=0)
 
template
<
typename
T
>
std::string GetCythonType (const util::ParamData &d, const typename boost::disable_if< arma::is_arma_type< T >>::type *=0, const typename boost::enable_if< data::HasSerialize< T >>::type *=0)
 
template
<
>
std::string GetCythonType< bool > (const util::ParamData &, const typename boost::disable_if< util::IsStdVector< bool >>::type *, const typename boost::disable_if< data::HasSerialize< bool >>::type *, const typename boost::disable_if< arma::is_arma_type< bool >>::type *)
 
template
<
>
std::string GetCythonType< double > (const util::ParamData &, const typename boost::disable_if< util::IsStdVector< double >>::type *, const typename boost::disable_if< data::HasSerialize< double >>::type *, const typename boost::disable_if< arma::is_arma_type< double >>::type *)
 
template
<
>
std::string GetCythonType< int > (const util::ParamData &, const typename boost::disable_if< util::IsStdVector< int >>::type *, const typename boost::disable_if< data::HasSerialize< int >>::type *, const typename boost::disable_if< arma::is_arma_type< int >>::type *)
 
template
<
>
std::string GetCythonType< size_t > (const util::ParamData &, const typename boost::disable_if< util::IsStdVector< size_t >>::type *, const typename boost::disable_if< data::HasSerialize< size_t >>::type *, const typename boost::disable_if< arma::is_arma_type< size_t >>::type *)
 
template
<
>
std::string GetCythonType< std::string > (const util::ParamData &, const typename boost::disable_if< util::IsStdVector< std::string >>::type *, const typename boost::disable_if< data::HasSerialize< std::string >>::type *, const typename boost::disable_if< arma::is_arma_type< std::string >>::type *)
 
template
<
typename
T
>
std::string GetNumpyType ()
 
template
<
>
std::string GetNumpyType< double > ()
 
template
<
>
std::string GetNumpyType< size_t > ()
 
template
<
typename
T
>
std::string GetNumpyTypeChar ()
 
template
<
>
std::string GetNumpyTypeChar< arma::Col< size_t > > ()
 
template
<
>
std::string GetNumpyTypeChar< arma::mat > ()
 
template
<
>
std::string GetNumpyTypeChar< arma::Mat< size_t > > ()
 
template
<
>
std::string GetNumpyTypeChar< arma::Row< size_t > > ()
 
template
<
>
std::string GetNumpyTypeChar< arma::rowvec > ()
 
template
<
>
std::string GetNumpyTypeChar< arma::vec > ()
 
template
<
typename
T
>
void GetParam (const util::ParamData &d, const void *, void *output)
 All Python binding types are exactly what is held in the ParamData, so no special handling is necessary. 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 of a simple type. More...

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

 
template
<
typename
T
>
std::string GetPrintableParam (const util::ParamData &data, const typename boost::enable_if< arma::is_arma_type< T >>::type *=0)
 Print a matrix option (this prints its size). 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::enable_if< data::HasSerialize< T >>::type *=0)
 Print a serializable class option (this prints the class name). More...

 
template
<
typename
T
>
std::string GetPrintableParam (const util::ParamData &data, const typename boost::enable_if< std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>>::type *=0)
 Print a combination DatasetInfo/matrix parameter. 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 GetPrintableType (const util::ParamData &, 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< arma::is_arma_type< T >>::type *=0, const typename boost::disable_if< std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>>::type *=0)
 
template
<
typename
T
>
std::string GetPrintableType (const util::ParamData &d, const typename boost::enable_if< util::IsStdVector< T >>::type *=0, const typename boost::disable_if< std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>>::type *=0)
 
template
<
typename
T
>
std::string GetPrintableType (const util::ParamData &, const typename boost::enable_if< arma::is_arma_type< T >>::type *=0, const typename boost::disable_if< std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>>::type *=0)
 
template
<
typename
T
>
std::string GetPrintableType (const util::ParamData &, const typename boost::enable_if< std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>>::type *=0)
 
template
<
typename
T
>
std::string GetPrintableType (const util::ParamData &d, const typename boost::disable_if< arma::is_arma_type< T >>::type *=0, const typename boost::enable_if< data::HasSerialize< T >>::type *=0, const typename boost::disable_if< std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>>::type *=0)
 
template
<
typename
T
>
void GetPrintableType (const util::ParamData &d, const void *, void *output)
 
template
<
>
std::string GetPrintableType< bool > (const util::ParamData &, const typename boost::disable_if< util::IsStdVector< bool >>::type *, const typename boost::disable_if< data::HasSerialize< bool >>::type *, const typename boost::disable_if< arma::is_arma_type< bool >>::type *, const typename boost::disable_if< std::is_same< bool, std::tuple< data::DatasetInfo, arma::mat >>>::type *)
 
template
<
>
std::string GetPrintableType< double > (const util::ParamData &, const typename boost::disable_if< util::IsStdVector< double >>::type *, const typename boost::disable_if< data::HasSerialize< double >>::type *, const typename boost::disable_if< arma::is_arma_type< double >>::type *, const typename boost::disable_if< std::is_same< double, std::tuple< data::DatasetInfo, arma::mat >>>::type *)
 
template
<
>
std::string GetPrintableType< int > (const util::ParamData &, const typename boost::disable_if< util::IsStdVector< int >>::type *, const typename boost::disable_if< data::HasSerialize< int >>::type *, const typename boost::disable_if< arma::is_arma_type< int >>::type *, const typename boost::disable_if< std::is_same< int, std::tuple< data::DatasetInfo, arma::mat >>>::type *)
 
template
<
>
std::string GetPrintableType< size_t > (const util::ParamData &, const typename boost::disable_if< util::IsStdVector< size_t >>::type *, const typename boost::disable_if< data::HasSerialize< size_t >>::type *, const typename boost::disable_if< arma::is_arma_type< size_t >>::type *, const typename boost::disable_if< std::is_same< size_t, std::tuple< data::DatasetInfo, arma::mat >>>::type *)
 
template
<
>
std::string GetPrintableType< std::string > (const util::ParamData &, const typename boost::disable_if< util::IsStdVector< std::string >>::type *, const typename boost::disable_if< data::HasSerialize< std::string >>::type *, const typename boost::disable_if< arma::is_arma_type< std::string >>::type *, const typename boost::disable_if< std::is_same< std::string, std::tuple< data::DatasetInfo, arma::mat >>>::type *)
 
bool IgnoreCheck (const std::string &paramName)
 Print whether or not we should ignore a check on the given parameter. More...

 
bool IgnoreCheck (const std::vector< std::string > &constraints)
 Print whether or not we should ignore a check on the given set of constraints. More...

 
bool IgnoreCheck (const std::vector< std::pair< std::string, bool >> &constraints, const std::string &paramName)
 Print whether or not we should ignore a check on the given set of constraints. More...

 
template
<
typename
T
>
void ImportDecl (const util::ParamData &d, const size_t indent, const typename boost::disable_if< arma::is_arma_type< T >>::type *=0, const typename boost::enable_if< data::HasSerialize< T >>::type *=0)
 For a serializable type, print a cppclass definition. More...

 
template
<
typename
T
>
void ImportDecl (const util::ParamData &, const size_t, const typename boost::disable_if< arma::is_arma_type< T >>::type *=0, const typename boost::disable_if< data::HasSerialize< T >>::type *=0)
 For a non-serializable type, print nothing. More...

 
template
<
typename
T
>
void ImportDecl (const util::ParamData &, const size_t, const typename boost::enable_if< arma::is_arma_type< T >>::type *=0)
 For a matrix type, print nothing. More...

 
template
<
typename
T
>
void ImportDecl (const util::ParamData &d, const void *indent, void *)
 Print the cppclass definition for a serializable model; print nothing for a non-serializable type. More...

 
std::string ParamString (const std::string &paramName)
 Given the parameter name, determine what it would actually be when passed to the command line. More...

 
template
<
typename
T
>
void PrintClassDefn (const util::ParamData &, const typename boost::disable_if< arma::is_arma_type< T >>::type *=0, const typename boost::disable_if< data::HasSerialize< T >>::type *=0)
 Non-serializable models don't require any special definitions, so this prints nothing. More...

 
template
<
typename
T
>
void PrintClassDefn (const util::ParamData &, const typename boost::enable_if< arma::is_arma_type< T >>::type *=0)
 Matrices don't require any special definitions, so this prints nothing. More...

 
template
<
typename
T
>
void PrintClassDefn (const util::ParamData &d, const typename boost::disable_if< arma::is_arma_type< T >>::type *=0, const typename boost::enable_if< data::HasSerialize< T >>::type *=0)
 Serializable models require a special class definition. More...

 
template
<
typename
T
>
void PrintClassDefn (const util::ParamData &d, const void *, void *)
 Print the class definition to stdout. More...

 
std::string PrintDataset (const std::string &datasetName)
 Given the name of a matrix, print it. More...

 
std::string PrintDefault (const std::string &paramName)
 Given a parameter name, print its corresponding default value. More...

 
template
<
typename
T
>
void PrintDefn (const util::ParamData &d, const void *, void *)
 Print the definition for a Python binding parameter to stdout. More...

 
template
<
typename
T
>
void PrintDoc (const util::ParamData &d, const void *input, void *)
 Print the docstring documentation for a given parameter. More...

 
std::string PrintImport (const std::string &bindingName)
 Print any import information for the Python binding. More...

 
std::string PrintInputOptions ()
 
template<typename T , typename... Args>
std::string PrintInputOptions (const std::string &paramName, const T &value, Args... args)
 Print an input option. More...

 
template
<
typename
T
>
void PrintInputProcessing (const util::ParamData &d, const size_t indent, const typename boost::disable_if< util::IsStdVector< T >>::type *=0, 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)
 Print input processing for a standard option type. More...

 
template
<
typename
T
>
void PrintInputProcessing (const util::ParamData &d, const size_t indent, 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, const typename boost::enable_if< util::IsStdVector< T >>::type *=0)
 Print input processing for a vector type. More...

 
template
<
typename
T
>
void PrintInputProcessing (const util::ParamData &d, const size_t indent, const typename boost::disable_if< util::IsStdVector< T >>::type *=0, const typename boost::enable_if< arma::is_arma_type< T >>::type *=0)
 Print input processing for a matrix type. More...

 
template
<
typename
T
>
void PrintInputProcessing (const util::ParamData &d, const size_t indent, const typename boost::disable_if< util::IsStdVector< T >>::type *=0, const typename boost::disable_if< arma::is_arma_type< T >>::type *=0, const typename boost::enable_if< data::HasSerialize< T >>::type *=0)
 Print input processing for a serializable type. More...

 
template
<
typename
T
>
void PrintInputProcessing (const util::ParamData &d, const size_t indent, const typename boost::disable_if< util::IsStdVector< T >>::type *=0, const typename boost::enable_if< std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>>::type *=0)
 Print input processing for a matrix/DatasetInfo type. More...

 
template
<
typename
T
>
void PrintInputProcessing (const util::ParamData &d, const void *input, void *)
 Given parameter information and the current number of spaces for indentation, print the code to process the input to cout. More...

 
std::string PrintModel (const std::string &modelName)
 Given the name of a model, print it. More...

 
std::string PrintOutputOptionInfo ()
 Print any special information about output options. More...

 
std::string PrintOutputOptions ()
 
template<typename T , typename... Args>
std::string PrintOutputOptions (const std::string &paramName, const T &value, Args... args)
 
template
<
typename
T
>
void PrintOutputProcessing (const util::ParamData &d, const size_t indent, const bool onlyOutput, 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)
 Print output processing for a regular parameter type. More...

 
template
<
typename
T
>
void PrintOutputProcessing (const util::ParamData &d, const size_t indent, const bool onlyOutput, const typename boost::enable_if< arma::is_arma_type< T >>::type *=0)
 Print output processing for a matrix type. More...

 
template
<
typename
T
>
void PrintOutputProcessing (const util::ParamData &d, const size_t indent, const bool onlyOutput, const typename boost::enable_if< std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>>::type *=0)
 Print output processing for a dataset info / matrix combination. More...

 
template
<
typename
T
>
void PrintOutputProcessing (const util::ParamData &d, const size_t indent, const bool onlyOutput, const typename boost::disable_if< arma::is_arma_type< T >>::type *=0, const typename boost::enable_if< data::HasSerialize< T >>::type *=0)
 Print output processing for a serializable model. More...

 
template
<
typename
T
>
void PrintOutputProcessing (const util::ParamData &d, const void *input, void *)
 Given parameter information and the current number of spaces for indentation, print the code to process the output to cout. More...

 
void PrintPYX (const util::ProgramDoc &programInfo, const std::string &mainFilename, const std::string &functionName)
 Given a list of parameter definition and program documentation, print a generated .pyx file to stdout. More...

 
template
<
typename
T
>
std::string PrintTypeDoc (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)
 Return a string representing the command-line type of an option. More...

 
template
<
typename
T
>
std::string PrintTypeDoc (const util::ParamData &data, const typename std::enable_if< util::IsStdVector< T >::value >::type *=0)
 Return a string representing the command-line type of a vector. More...

 
template
<
typename
T
>
std::string PrintTypeDoc (const util::ParamData &data, const typename std::enable_if< arma::is_arma_type< T >::value >::type *=0)
 Return a string representing the command-line type of a matrix option. More...

 
template
<
typename
T
>
std::string PrintTypeDoc (const util::ParamData &data, const typename std::enable_if< std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>::value >::type *=0)
 Return a string representing the command-line type of a matrix tuple option. More...

 
template
<
typename
T
>
std::string PrintTypeDoc (const util::ParamData &data, const typename boost::disable_if< arma::is_arma_type< T >>::type *=0, const typename boost::enable_if< data::HasSerialize< T >>::type *=0)
 Return a string representing the command-line type of a model. More...

 
template
<
typename
T
>
void PrintTypeDoc (const util::ParamData &data, const void *, void *output)
 Print the command-line type of an option into a string. More...

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

 
template
<
>
std::string PrintValue (const bool &value, bool quotes)
 
template<typename... Args>
std::string ProgramCall (const std::string &programName, Args... args)
 Given a name of a binding and a variable number of arguments (and their contents), print the corresponding function call. More...

 
std::string ProgramCall (const std::string &programName)
 Given the name of a binding, print a program call assuming that all options are specified. More...

 
template
<
typename
T
>
void SerializeIn (T *t, const std::string &str, const std::string &name)
 
template
<
typename
T
>
std::string SerializeOut (T *t, const std::string &name)
 
void StripType (const std::string &inputType, std::string &strippedType, std::string &printedType, std::string &defaultsType)
 Given an input type like, e.g., "LogisticRegression<>", return three types that can be used in Python code. More...

 

Variables

std::string programName
 

Function Documentation

◆ DefaultParam()

void mlpack::bindings::python::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 80 of file default_param.hpp.

◆ DefaultParamImpl() [1/5]

std::string mlpack::bindings::python::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/5]

std::string mlpack::bindings::python::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/5]

std::string mlpack::bindings::python::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/5]

std::string mlpack::bindings::python::DefaultParamImpl ( const util::ParamData data,
const typename boost::enable_if_c< arma::is_arma_type< 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).

◆ DefaultParamImpl() [5/5]

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

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

◆ GetArmaType()

std::string mlpack::bindings::python::GetArmaType ( )
inline

This is used for arma::Mat<> types; it will return "mat" for matrices, "row" for row vectors, and "col" for column vectors.

Definition at line 28 of file get_arma_type.hpp.

◆ GetBindingName()

std::string mlpack::bindings::python::GetBindingName ( const std::string &  bindingName)
inline

Given the name of a binding, print its Python name.

◆ GetCythonType() [1/4]

std::string mlpack::bindings::python::GetCythonType ( const util::ParamData ,
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< arma::is_arma_type< T >>::type *  = 0 
)
inline

Definition at line 24 of file get_cython_type.hpp.

◆ GetCythonType() [2/4]

std::string mlpack::bindings::python::GetCythonType ( const util::ParamData d,
const typename boost::enable_if< util::IsStdVector< T >>::type *  = 0 
)
inline

Definition at line 84 of file get_cython_type.hpp.

◆ GetCythonType() [3/4]

std::string mlpack::bindings::python::GetCythonType ( const util::ParamData d,
const typename boost::enable_if< arma::is_arma_type< T >>::type *  = 0 
)
inline

Definition at line 92 of file get_cython_type.hpp.

◆ GetCythonType() [4/4]

std::string mlpack::bindings::python::GetCythonType ( const util::ParamData d,
const typename boost::disable_if< arma::is_arma_type< T >>::type *  = 0,
const typename boost::enable_if< data::HasSerialize< T >>::type *  = 0 
)
inline

Definition at line 106 of file get_cython_type.hpp.

References ParamData::cppType.

◆ GetCythonType< bool >()

std::string mlpack::bindings::python::GetCythonType< bool > ( const util::ParamData ,
const typename boost::disable_if< util::IsStdVector< bool >>::type *  ,
const typename boost::disable_if< data::HasSerialize< bool >>::type *  ,
const typename boost::disable_if< arma::is_arma_type< bool >>::type *   
)
inline

Definition at line 74 of file get_cython_type.hpp.

◆ GetCythonType< double >()

std::string mlpack::bindings::python::GetCythonType< double > ( const util::ParamData ,
const typename boost::disable_if< util::IsStdVector< double >>::type *  ,
const typename boost::disable_if< data::HasSerialize< double >>::type *  ,
const typename boost::disable_if< arma::is_arma_type< double >>::type *   
)
inline

Definition at line 44 of file get_cython_type.hpp.

◆ GetCythonType< int >()

std::string mlpack::bindings::python::GetCythonType< int > ( const util::ParamData ,
const typename boost::disable_if< util::IsStdVector< int >>::type *  ,
const typename boost::disable_if< data::HasSerialize< int >>::type *  ,
const typename boost::disable_if< arma::is_arma_type< int >>::type *   
)
inline

Definition at line 34 of file get_cython_type.hpp.

◆ GetCythonType< size_t >()

std::string mlpack::bindings::python::GetCythonType< size_t > ( const util::ParamData ,
const typename boost::disable_if< util::IsStdVector< size_t >>::type *  ,
const typename boost::disable_if< data::HasSerialize< size_t >>::type *  ,
const typename boost::disable_if< arma::is_arma_type< size_t >>::type *   
)
inline

Definition at line 64 of file get_cython_type.hpp.

◆ GetCythonType< std::string >()

std::string mlpack::bindings::python::GetCythonType< std::string > ( const util::ParamData ,
const typename boost::disable_if< util::IsStdVector< std::string >>::type *  ,
const typename boost::disable_if< data::HasSerialize< std::string >>::type *  ,
const typename boost::disable_if< arma::is_arma_type< std::string >>::type *   
)
inline

Definition at line 54 of file get_cython_type.hpp.

◆ GetNumpyType()

std::string mlpack::bindings::python::GetNumpyType ( )
inline

Definition at line 22 of file get_numpy_type.hpp.

◆ GetNumpyType< double >()

std::string mlpack::bindings::python::GetNumpyType< double > ( )
inline

Definition at line 28 of file get_numpy_type.hpp.

◆ GetNumpyType< size_t >()

std::string mlpack::bindings::python::GetNumpyType< size_t > ( )
inline

Definition at line 34 of file get_numpy_type.hpp.

◆ GetNumpyTypeChar()

std::string mlpack::bindings::python::GetNumpyTypeChar ( )
inline

Definition at line 23 of file get_numpy_type_char.hpp.

◆ GetNumpyTypeChar< arma::Col< size_t > >()

std::string mlpack::bindings::python::GetNumpyTypeChar< arma::Col< size_t > > ( )
inline

Definition at line 36 of file get_numpy_type_char.hpp.

◆ GetNumpyTypeChar< arma::mat >()

std::string mlpack::bindings::python::GetNumpyTypeChar< arma::mat > ( )
inline

Definition at line 49 of file get_numpy_type_char.hpp.

◆ GetNumpyTypeChar< arma::Mat< size_t > >()

std::string mlpack::bindings::python::GetNumpyTypeChar< arma::Mat< size_t > > ( )
inline

Definition at line 30 of file get_numpy_type_char.hpp.

◆ GetNumpyTypeChar< arma::Row< size_t > >()

std::string mlpack::bindings::python::GetNumpyTypeChar< arma::Row< size_t > > ( )
inline

Definition at line 42 of file get_numpy_type_char.hpp.

◆ GetNumpyTypeChar< arma::rowvec >()

std::string mlpack::bindings::python::GetNumpyTypeChar< arma::rowvec > ( )
inline

Definition at line 61 of file get_numpy_type_char.hpp.

◆ GetNumpyTypeChar< arma::vec >()

std::string mlpack::bindings::python::GetNumpyTypeChar< arma::vec > ( )
inline

Definition at line 55 of file get_numpy_type_char.hpp.

◆ GetParam()

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

All Python binding types are exactly what is held in the ParamData, so no special handling is necessary.

Definition at line 26 of file get_param.hpp.

References ParamData::value.

◆ GetPrintableParam() [1/6]

std::string mlpack::bindings::python::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 of a simple type.

Print an option.

Definition at line 26 of file get_printable_param.hpp.

References ParamData::value.

◆ GetPrintableParam() [2/6]

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

Print a vector option, with spaces between it.

Definition at line 43 of file get_printable_param.hpp.

References ParamData::value.

◆ GetPrintableParam() [3/6]

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

Print a matrix option (this prints its size).

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

Definition at line 59 of file get_printable_param.hpp.

References ParamData::value.

◆ GetPrintableParam() [4/6]

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

Print a serializable class option (this prints the class name).

Print a serializable class option (this just prints the filename).

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

Definition at line 75 of file get_printable_param.hpp.

References ParamData::cppType, and ParamData::value.

◆ GetPrintableParam() [5/6]

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

Print a combination DatasetInfo/matrix parameter.

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

Definition at line 89 of file get_printable_param.hpp.

References ParamData::value.

◆ GetPrintableParam() [6/6]

void mlpack::bindings::python::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.

Parameters
dataParameter data struct.
inputUnused parameter.
outputOutput storage for the string.

Definition at line 114 of file get_printable_param.hpp.

◆ GetPrintableType() [1/6]

std::string mlpack::bindings::python::GetPrintableType ( const util::ParamData ,
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< arma::is_arma_type< T >>::type *  = 0,
const typename boost::disable_if< std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>>::type *  = 0 
)
inline

◆ GetPrintableType() [2/6]

std::string mlpack::bindings::python::GetPrintableType ( const util::ParamData d,
const typename boost::enable_if< util::IsStdVector< T >>::type *  = 0,
const typename boost::disable_if< std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>>::type *  = 0 
)
inline

◆ GetPrintableType() [3/6]

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

◆ GetPrintableType() [4/6]

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

◆ GetPrintableType() [5/6]

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

◆ GetPrintableType() [6/6]

void mlpack::bindings::python::GetPrintableType ( const util::ParamData d,
const void *  ,
void *  output 
)

Definition at line 106 of file get_printable_type.hpp.

◆ GetPrintableType< bool >()

std::string mlpack::bindings::python::GetPrintableType< bool > ( const util::ParamData ,
const typename boost::disable_if< util::IsStdVector< bool >>::type *  ,
const typename boost::disable_if< data::HasSerialize< bool >>::type *  ,
const typename boost::disable_if< arma::is_arma_type< bool >>::type *  ,
const typename boost::disable_if< std::is_same< bool, std::tuple< data::DatasetInfo, arma::mat >>>::type *   
)
inline

◆ GetPrintableType< double >()

std::string mlpack::bindings::python::GetPrintableType< double > ( const util::ParamData ,
const typename boost::disable_if< util::IsStdVector< double >>::type *  ,
const typename boost::disable_if< data::HasSerialize< double >>::type *  ,
const typename boost::disable_if< arma::is_arma_type< double >>::type *  ,
const typename boost::disable_if< std::is_same< double, std::tuple< data::DatasetInfo, arma::mat >>>::type *   
)
inline

◆ GetPrintableType< int >()

std::string mlpack::bindings::python::GetPrintableType< int > ( const util::ParamData ,
const typename boost::disable_if< util::IsStdVector< int >>::type *  ,
const typename boost::disable_if< data::HasSerialize< int >>::type *  ,
const typename boost::disable_if< arma::is_arma_type< int >>::type *  ,
const typename boost::disable_if< std::is_same< int, std::tuple< data::DatasetInfo, arma::mat >>>::type *   
)
inline

◆ GetPrintableType< size_t >()

std::string mlpack::bindings::python::GetPrintableType< size_t > ( const util::ParamData ,
const typename boost::disable_if< util::IsStdVector< size_t >>::type *  ,
const typename boost::disable_if< data::HasSerialize< size_t >>::type *  ,
const typename boost::disable_if< arma::is_arma_type< size_t >>::type *  ,
const typename boost::disable_if< std::is_same< size_t, std::tuple< data::DatasetInfo, arma::mat >>>::type *   
)
inline

◆ GetPrintableType< std::string >()

std::string mlpack::bindings::python::GetPrintableType< std::string > ( const util::ParamData ,
const typename boost::disable_if< util::IsStdVector< std::string >>::type *  ,
const typename boost::disable_if< data::HasSerialize< std::string >>::type *  ,
const typename boost::disable_if< arma::is_arma_type< std::string >>::type *  ,
const typename boost::disable_if< std::is_same< std::string, std::tuple< data::DatasetInfo, arma::mat >>>::type *   
)
inline

◆ IgnoreCheck() [1/3]

bool mlpack::bindings::python::IgnoreCheck ( const std::string &  paramName)
inline

Print whether or not we should ignore a check on the given parameter.

For Python bindings, we ignore any checks on output parameters, so if paramName is an output parameter, this returns true.

◆ IgnoreCheck() [2/3]

bool mlpack::bindings::python::IgnoreCheck ( const std::vector< std::string > &  constraints)
inline

Print whether or not we should ignore a check on the given set of constraints.

For Python bindings, we ignore any checks on output parameters, so if any parameter is an output parameter, this returns true.

◆ IgnoreCheck() [3/3]

bool mlpack::bindings::python::IgnoreCheck ( const std::vector< std::pair< std::string, bool >> &  constraints,
const std::string &  paramName 
)
inline

Print whether or not we should ignore a check on the given set of constraints.

For Python bindings, we ignore any checks on output parameters, so if any constraint parameter or the main parameter are output parameters, this returns true.

◆ ImportDecl() [1/4]

void mlpack::bindings::python::ImportDecl ( const util::ParamData d,
const size_t  indent,
const typename boost::disable_if< arma::is_arma_type< T >>::type *  = 0,
const typename boost::enable_if< data::HasSerialize< T >>::type *  = 0 
)

For a serializable type, print a cppclass definition.

This will give output of the form:

cdef cppclass Type: Type() nogil

Definition at line 26 of file import_decl.hpp.

References ParamData::cppType, and StripType().

◆ ImportDecl() [2/4]

void mlpack::bindings::python::ImportDecl ( const util::ParamData ,
const size_t  ,
const typename boost::disable_if< arma::is_arma_type< T >>::type *  = 0,
const typename boost::disable_if< data::HasSerialize< T >>::type *  = 0 
)

For a non-serializable type, print nothing.

Definition at line 53 of file import_decl.hpp.

◆ ImportDecl() [3/4]

void mlpack::bindings::python::ImportDecl ( const util::ParamData ,
const size_t  ,
const typename boost::enable_if< arma::is_arma_type< T >>::type *  = 0 
)

For a matrix type, print nothing.

Definition at line 66 of file import_decl.hpp.

◆ ImportDecl() [4/4]

void mlpack::bindings::python::ImportDecl ( const util::ParamData d,
const void *  indent,
void *   
)

Print the cppclass definition for a serializable model; print nothing for a non-serializable type.

Parameters
dParameter info struct.
inputPointer to size_t indicating indent.
outputUnused parameter.

Definition at line 83 of file import_decl.hpp.

◆ ParamString()

std::string mlpack::bindings::python::ParamString ( const std::string &  paramName)
inline

Given the parameter name, determine what it would actually be when passed to the command line.

◆ PrintClassDefn() [1/4]

void mlpack::bindings::python::PrintClassDefn ( const util::ParamData ,
const typename boost::disable_if< arma::is_arma_type< T >>::type *  = 0,
const typename boost::disable_if< data::HasSerialize< T >>::type *  = 0 
)

Non-serializable models don't require any special definitions, so this prints nothing.

Definition at line 26 of file print_class_defn.hpp.

◆ PrintClassDefn() [2/4]

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

Matrices don't require any special definitions, so this prints nothing.

Definition at line 38 of file print_class_defn.hpp.

◆ PrintClassDefn() [3/4]

void mlpack::bindings::python::PrintClassDefn ( const util::ParamData d,
const typename boost::disable_if< arma::is_arma_type< T >>::type *  = 0,
const typename boost::enable_if< data::HasSerialize< T >>::type *  = 0 
)

Serializable models require a special class definition.

This will produce code like:

cdef class <ModelType>Type: cdef <ModelType>* modelptr

def cinit(self): self.modelptr = new <ModelType>()

def dealloc(self): del self.modelptr

def getstate(self): return SerializeOut(self.modelptr, "<ModelType>")

def setstate(self, state): SerializeIn(self.modelptr, state, "<ModelType>")

def reduce_ex(self): return (self.__class__, (), self.__getstate__())

Definition at line 49 of file print_class_defn.hpp.

References ParamData::cppType, and StripType().

◆ PrintClassDefn() [4/4]

void mlpack::bindings::python::PrintClassDefn ( const util::ParamData d,
const void *  ,
void *   
)

Print the class definition to stdout.

Only serializable models require a different class definition, so anything else does nothing.

Parameters
dParameter data.
inputUnused parameter.
outputUnused parameter.

Definition at line 112 of file print_class_defn.hpp.

◆ PrintDataset()

std::string mlpack::bindings::python::PrintDataset ( const std::string &  datasetName)
inline

Given the name of a matrix, print it.

Here we do not need to modify anything.

◆ PrintDefault()

std::string mlpack::bindings::python::PrintDefault ( const std::string &  paramName)
inline

Given a parameter name, print its corresponding default value.

◆ PrintDefn()

void mlpack::bindings::python::PrintDefn ( const util::ParamData d,
const void *  ,
void *   
)

Print the definition for a Python binding parameter to stdout.

This is the definition in the function declaration.

Definition at line 26 of file print_defn.hpp.

References ParamData::name, and ParamData::required.

◆ PrintDoc()

void mlpack::bindings::python::PrintDoc ( const util::ParamData d,
const void *  input,
void *   
)

Print the docstring documentation for a given parameter.

You are responsible for setting up the line—this does not handle indentation or anything. This is meant to produce a line of documentation describing a single parameter.

The indent parameter (void* input, which should be a pointer to a size_t) should be passed to know how much to indent for a new line.

Parameters
dParameter data struct.
inputPointer to size_t containing indent.
outputUnused parameter.

Definition at line 36 of file print_doc.hpp.

References ParamData::cppType, ParamData::desc, mlpack::util::HyphenateString(), ParamData::name, and ParamData::required.

◆ PrintImport()

std::string mlpack::bindings::python::PrintImport ( const std::string &  bindingName)
inline

Print any import information for the Python binding.

◆ PrintInputOptions() [1/2]

std::string mlpack::bindings::python::PrintInputOptions ( )
inline

◆ PrintInputOptions() [2/2]

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

Print an input option.

This will throw an exception if the parameter does not exist in CLI. For a parameter 'x' with value '5', this will print something like x=5.

◆ PrintInputProcessing() [1/6]

void mlpack::bindings::python::PrintInputProcessing ( const util::ParamData d,
const size_t  indent,
const typename boost::disable_if< util::IsStdVector< T >>::type *  = 0,
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 
)

Print input processing for a standard option type.

This gives us code like:

Detect if the parameter was passed; set if so.

if param_name is not None: if isinstance(param_name, int): SetParam[int](<const string>=""> 'param_name', param_name) CLI.SetPassed(<const string>=""> 'param_name') else: raise TypeError("'param_name' must have type 'list'!")

Definition at line 31 of file print_input_processing.hpp.

References ParamData::name, and ParamData::required.

◆ PrintInputProcessing() [2/6]

void mlpack::bindings::python::PrintInputProcessing ( const util::ParamData d,
const size_t  indent,
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,
const typename boost::enable_if< util::IsStdVector< T >>::type *  = 0 
)

Print input processing for a vector type.

This gives us code like: if param_name is not None: if isinstance(param_name, list): if len(param_name) > 0: if isinstance(param_name[0], str): SetParam[vector[string]](<const string>=""> 'param_name', param_name) CLI.SetPassed(<const string>=""> 'param_name') else: raise TypeError("'param_name' must have type 'list of strs'!") else: raise TypeError("'param_name' must have type 'list'!")

Definition at line 164 of file print_input_processing.hpp.

References ParamData::name, and ParamData::required.

◆ PrintInputProcessing() [3/6]

void mlpack::bindings::python::PrintInputProcessing ( const util::ParamData d,
const size_t  indent,
const typename boost::disable_if< util::IsStdVector< T >>::type *  = 0,
const typename boost::enable_if< arma::is_arma_type< T >>::type *  = 0 
)

Print input processing for a matrix type.

This gives us code like:

Detect if the parameter was passed; set if so.

if param_name is not None: param_name_tuple = to_matrix(param_name) if param_name_tuple[0].shape[0] == 1 or param_name_tuple[0].shape[1] == 1: param_name_tuple[0].shape = (param_name_tuple[0].size,) param_name_mat = arma_numpy.numpy_to_mat_s(param_name_tuple[0], param_name_tuple[1]) SetParam[mat](<const string>=""> 'param_name', dereference(param_name_mat)) CLI.SetPassed(<const string>=""> 'param_name')

Definition at line 251 of file print_input_processing.hpp.

References ParamData::name, and ParamData::required.

◆ PrintInputProcessing() [4/6]

void mlpack::bindings::python::PrintInputProcessing ( const util::ParamData d,
const size_t  indent,
const typename boost::disable_if< util::IsStdVector< T >>::type *  = 0,
const typename boost::disable_if< arma::is_arma_type< T >>::type *  = 0,
const typename boost::enable_if< data::HasSerialize< T >>::type *  = 0 
)

Print input processing for a serializable type.

This gives us code like:

Detect if the parameter was passed; set if so.

if param_name is not None: try: SetParamPtr[Model]('param_name', (<ModelType?> param_name).modelptr, CLI.HasParam('copy_all_inputs')) except TypeError as e: if type(param_name).__name__ == "ModelType": SetParamPtr[Model]('param_name', (<ModelType> param_name).modelptr, CLI.HasParam('copy_all_inputs')) else: raise e CLI.SetPassed(<const string>=""> 'param_name')

Definition at line 373 of file print_input_processing.hpp.

References ParamData::cppType, ParamData::name, ParamData::required, and StripType().

◆ PrintInputProcessing() [5/6]

void mlpack::bindings::python::PrintInputProcessing ( const util::ParamData d,
const size_t  indent,
const typename boost::disable_if< util::IsStdVector< T >>::type *  = 0,
const typename boost::enable_if< std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>>::type *  = 0 
)

Print input processing for a matrix/DatasetInfo type.

We want to generate code like the following:

if param_name is not None: param_name_tuple = to_matrix_with_info(param_name) if len(param_name_tuple[0].shape) < 2: param_name_tuple[0].shape = (param_name_tuple[0].size,) param_name_mat = arma_numpy.numpy_to_matrix_d(param_name_tuple[0]) SetParamWithInfo[mat](<const string>=""> 'param_name', dereference(param_name_mat), &param_name_tuple[1][0]) CLI.SetPassed(<const string>=""> 'param_name')

Definition at line 446 of file print_input_processing.hpp.

References ParamData::name, and ParamData::required.

◆ PrintInputProcessing() [6/6]

void mlpack::bindings::python::PrintInputProcessing ( const util::ParamData d,
const void *  input,
void *   
)

Given parameter information and the current number of spaces for indentation, print the code to process the input to cout.

This code assumes that data.input is true, and should not be called when data.input is false.

The number of spaces to indent should be passed through the input pointer.

Parameters
dParameter data struct.
inputPointer to size_t holding the indentation.
outputUnused parameter.

Definition at line 526 of file print_input_processing.hpp.

◆ PrintModel()

std::string mlpack::bindings::python::PrintModel ( const std::string &  modelName)
inline

Given the name of a model, print it.

Here we do not need to modify anything.

◆ PrintOutputOptionInfo()

std::string mlpack::bindings::python::PrintOutputOptionInfo ( )
inline

Print any special information about output options.

◆ PrintOutputOptions() [1/2]

std::string mlpack::bindings::python::PrintOutputOptions ( )
inline

◆ PrintOutputOptions() [2/2]

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

◆ PrintOutputProcessing() [1/5]

void mlpack::bindings::python::PrintOutputProcessing ( const util::ParamData d,
const size_t  indent,
const bool  onlyOutput,
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 
)

Print output processing for a regular parameter type.

This gives us code like:

result = CLI.GetParam[int]('param_name')

This gives us code like:

result['param_name'] = CLI.GetParam[int]('param_name')

Definition at line 29 of file print_output_processing.hpp.

References ParamData::name.

◆ PrintOutputProcessing() [2/5]

void mlpack::bindings::python::PrintOutputProcessing ( const util::ParamData d,
const size_t  indent,
const bool  onlyOutput,
const typename boost::enable_if< arma::is_arma_type< T >>::type *  = 0 
)

Print output processing for a matrix type.

This gives us code like:

result = arma_numpy.mat_to_numpy_X(CLI.GetParam[mat]("name"))

where X indicates the type to convert to.

This gives us code like:

result['param_name'] = arma_numpy.mat_to_numpy_X(CLI.GetParam[mat]('name')

where X indicates the type to convert to.

Definition at line 85 of file print_output_processing.hpp.

References ParamData::name.

◆ PrintOutputProcessing() [3/5]

void mlpack::bindings::python::PrintOutputProcessing ( const util::ParamData d,
const size_t  indent,
const bool  onlyOutput,
const typename boost::enable_if< std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>>::type *  = 0 
)

Print output processing for a dataset info / matrix combination.

This gives us code like:

result = arma_numpy.mat_to_numpy_X(GetParamWithInfo[mat]('name'))

This gives us code like:

result['param_name'] = arma_numpy.mat_to_numpy_X(GetParamWithInfo[mat]('name'))

Definition at line 127 of file print_output_processing.hpp.

References ParamData::name.

◆ PrintOutputProcessing() [4/5]

void mlpack::bindings::python::PrintOutputProcessing ( const util::ParamData d,
const size_t  indent,
const bool  onlyOutput,
const typename boost::disable_if< arma::is_arma_type< T >>::type *  = 0,
const typename boost::enable_if< data::HasSerialize< T >>::type *  = 0 
)

Print output processing for a serializable model.

This gives us code like:

result = ModelType() (<ModelType?> result).modelptr = GetParamPtr[Model]('name')

But we also have to check to ensure there aren't any input model parameters of the same type that could have the same model pointer. So we need to loop through all input parameters that have the same type, and double-check.

This gives us code like:

result['name'] = ModelType() (<ModelType?> result['name']).modelptr = GetParamPtr[Model]('name'))

But we also have to check to ensure there aren't any input model parameters of the same type that could have the same model pointer. So we need to loop through all input parameters that have the same type, and double-check.

Definition at line 169 of file print_output_processing.hpp.

References ParamData::cppType, ParamData::input, ParamData::name, CLI::Parameters(), ParamData::required, and StripType().

◆ PrintOutputProcessing() [5/5]

void mlpack::bindings::python::PrintOutputProcessing ( const util::ParamData d,
const void *  input,
void *   
)

Given parameter information and the current number of spaces for indentation, print the code to process the output to cout.

This code assumes that data.input is false, and should not be called when data.input is true. If this is the only output, the results will be different.

The input pointer should be a pointer to a std::tuple<size_t, bool> where the first element is the indentation and the second element is a boolean representing whether or not this is the only output parameter.

Parameters
dParameter data struct.
inputPointer to size_t holding the indentation.
outputUnused parameter.

Definition at line 298 of file print_output_processing.hpp.

◆ PrintPYX()

void mlpack::bindings::python::PrintPYX ( const util::ProgramDoc programInfo,
const std::string &  mainFilename,
const std::string &  functionName 
)

Given a list of parameter definition and program documentation, print a generated .pyx file to stdout.

Parameters
parametersList of parameters the program will use (from CLI).
programInfoDocumentation for the program.
mainFilenameFilename of the main program (i.e. "/path/to/pca_main.cpp").
functionNameName of the function (i.e. "pca").

◆ PrintTypeDoc() [1/6]

std::string mlpack::bindings::python::PrintTypeDoc ( 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 
)

Return a string representing the command-line type of an option.

◆ PrintTypeDoc() [2/6]

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

Return a string representing the command-line type of a vector.

◆ PrintTypeDoc() [3/6]

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

Return a string representing the command-line type of a matrix option.

◆ PrintTypeDoc() [4/6]

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

Return a string representing the command-line type of a matrix tuple option.

◆ PrintTypeDoc() [5/6]

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

Return a string representing the command-line type of a model.

◆ PrintTypeDoc() [6/6]

void mlpack::bindings::python::PrintTypeDoc ( const util::ParamData data,
const void *  ,
void *  output 
)

Print the command-line type of an option into a string.

Definition at line 72 of file print_type_doc.hpp.

◆ PrintValue() [1/2]

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

Given a parameter type, print the corresponding value.

◆ PrintValue() [2/2]

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

◆ ProgramCall() [1/2]

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

Given a name of a binding and a variable number of arguments (and their contents), print the corresponding function call.

◆ ProgramCall() [2/2]

std::string mlpack::bindings::python::ProgramCall ( const std::string &  programName)
inline

Given the name of a binding, print a program call assuming that all options are specified.

◆ SerializeIn()

void mlpack::bindings::python::SerializeIn ( T *  t,
const std::string &  str,
const std::string &  name 
)

Definition at line 34 of file serialization.hpp.

◆ SerializeOut()

std::string mlpack::bindings::python::SerializeOut ( T *  t,
const std::string &  name 
)

Definition at line 22 of file serialization.hpp.

◆ StripType()

void mlpack::bindings::python::StripType ( const std::string &  inputType,
std::string &  strippedType,
std::string &  printedType,
std::string &  defaultsType 
)
inline

Given an input type like, e.g., "LogisticRegression<>", return three types that can be used in Python code.

strippedType will be a type with no template parameters (e.g. "LogisticRegression"), printedType will be a printable type with the template parameters (e.g. "LogisticRegression[]"), and defaultsType will be a printable type with a default template parameter (e.g. "LogisticRegression[T=*]") that can be used for class definitions.

Definition at line 28 of file strip_type.hpp.

Referenced by ImportDecl(), PrintClassDefn(), PrintInputProcessing(), and PrintOutputProcessing().

Variable Documentation

◆ programName

std::string programName