Classes | |
class | PyOption |
The Python option class. More... | |
Functions | |
template | |
void | DefaultParam (util::ParamData &data, const void *, void *output) |
Return the default value of an option. More... | |
template | |
std::string | DefaultParamImpl (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 | |
std::string | DefaultParamImpl (util::ParamData &data, const typename boost::enable_if< util::IsStdVector< T >>::type *=0) |
Return the default value of a vector option. More... | |
template | |
std::string | DefaultParamImpl (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 | |
std::string | DefaultParamImpl (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 | |
std::string | DefaultParamImpl (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 | |
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 | |
std::string | GetCythonType (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 | |
std::string | GetCythonType (util::ParamData &d, const typename boost::enable_if< util::IsStdVector< T >>::type *=0) |
template | |
std::string | GetCythonType (util::ParamData &d, const typename boost::enable_if< arma::is_arma_type< T >>::type *=0) |
template | |
std::string | GetCythonType (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 > (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 > (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 > (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 > (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 > (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 | |
std::string | GetNumpyType () |
template<> | |
std::string | GetNumpyType< double > () |
template<> | |
std::string | GetNumpyType< size_t > () |
template | |
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 | |
void | GetParam (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 | |
std::string | GetPrintableParam (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 | |
std::string | GetPrintableParam (util::ParamData &data, const typename boost::enable_if< util::IsStdVector< T >>::type *=0) |
Print a vector option, with spaces between it. More... | |
template | |
std::string | GetPrintableParam (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 | |
std::string | GetPrintableParam (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 | |
std::string | GetPrintableParam (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 | |
void | GetPrintableParam (util::ParamData &data, const void *, void *output) |
Print an option into a std::string. More... | |
template | |
std::string | GetPrintableType (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 | |
std::string | GetPrintableType (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 | |
std::string | GetPrintableType (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 | |
std::string | GetPrintableType (util::ParamData &, const typename boost::enable_if< std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>>::type *=0) |
template | |
std::string | GetPrintableType (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 | |
void | GetPrintableType (util::ParamData &d, const void *, void *output) |
template<> | |
std::string | GetPrintableType< bool > (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 > (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 > (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 > (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 > (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 ¶mName) |
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 ¶mName) |
Print whether or not we should ignore a check on the given set of constraints. More... | |
template | |
void | ImportDecl (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 | |
void | ImportDecl (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 | |
void | ImportDecl (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 | |
void | ImportDecl (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 ¶mName) |
Given the parameter name, determine what it would actually be when passed to the command line. More... | |
template | |
void | PrintClassDefn (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 | |
void | PrintClassDefn (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 | |
void | PrintClassDefn (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 | |
void | PrintClassDefn (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 ¶mName) |
Given a parameter name, print its corresponding default value. More... | |
template | |
void | PrintDefn (util::ParamData &d, const void *, void *) |
Print the definition for a Python binding parameter to stdout. More... | |
template | |
void | PrintDoc (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 | PrintInputOptionInfo () |
Print any special information about input options. More... | |
std::string | PrintInputOptions () |
template | |
std::string | PrintInputOptions (const std::string ¶mName, const T &value, Args... args) |
Print an input option. More... | |
template | |
void | PrintInputProcessing (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 | |
void | PrintInputProcessing (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 | |
void | PrintInputProcessing (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 | |
void | PrintInputProcessing (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 | |
void | PrintInputProcessing (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 | |
void | PrintInputProcessing (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 | |
std::string | PrintOutputOptions (const std::string ¶mName, const T &value, Args... args) |
template | |
void | PrintOutputProcessing (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 | |
void | PrintOutputProcessing (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 | |
void | PrintOutputProcessing (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 | |
void | PrintOutputProcessing (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 | |
void | PrintOutputProcessing (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::BindingDetails &doc, 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 | |
std::string | PrintTypeDoc (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 | |
std::string | PrintTypeDoc (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 | |
std::string | PrintTypeDoc (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 | |
std::string | PrintTypeDoc (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 | |
std::string | PrintTypeDoc (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 | |
void | PrintTypeDoc (util::ParamData &data, const void *, void *output) |
Print the command-line type of an option into a string. More... | |
template | |
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 | |
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 | |
void | SerializeIn (T *t, const std::string &str, const std::string &name) |
template | |
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 |
void mlpack::bindings::python::DefaultParam | ( | util::ParamData & | data, |
const void * | , | ||
void * | output | ||
) |
Return the default value of an option.
This is the function that will be placed into the IO functionMap.
Definition at line 80 of file default_param.hpp.
std::string mlpack::bindings::python::DefaultParamImpl | ( | 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.
std::string mlpack::bindings::python::DefaultParamImpl | ( | util::ParamData & | data, |
const typename boost::enable_if< util::IsStdVector< T >>::type * | = 0 |
||
) |
Return the default value of a vector option.
std::string mlpack::bindings::python::DefaultParamImpl | ( | util::ParamData & | data, |
const typename boost::enable_if< std::is_same< T, std::string >>::type * | = 0 |
||
) |
Return the default value of a string option.
std::string mlpack::bindings::python::DefaultParamImpl | ( | 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).
std::string mlpack::bindings::python::DefaultParamImpl | ( | 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).
|
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.
|
inline |
Given the name of a binding, print its Python name.
|
inline |
Definition at line 24 of file get_cython_type.hpp.
|
inline |
Definition at line 84 of file get_cython_type.hpp.
|
inline |
Definition at line 92 of file get_cython_type.hpp.
|
inline |
Definition at line 106 of file get_cython_type.hpp.
References ParamData::cppType.
|
inline |
Definition at line 74 of file get_cython_type.hpp.
|
inline |
Definition at line 44 of file get_cython_type.hpp.
|
inline |
Definition at line 34 of file get_cython_type.hpp.
|
inline |
Definition at line 64 of file get_cython_type.hpp.
|
inline |
Definition at line 54 of file get_cython_type.hpp.
|
inline |
Definition at line 22 of file get_numpy_type.hpp.
|
inline |
Definition at line 28 of file get_numpy_type.hpp.
|
inline |
Definition at line 34 of file get_numpy_type.hpp.
|
inline |
Definition at line 23 of file get_numpy_type_char.hpp.
|
inline |
Definition at line 36 of file get_numpy_type_char.hpp.
|
inline |
Definition at line 49 of file get_numpy_type_char.hpp.
|
inline |
Definition at line 30 of file get_numpy_type_char.hpp.
|
inline |
Definition at line 42 of file get_numpy_type_char.hpp.
|
inline |
Definition at line 61 of file get_numpy_type_char.hpp.
|
inline |
Definition at line 55 of file get_numpy_type_char.hpp.
void mlpack::bindings::python::GetParam | ( | 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.
std::string mlpack::bindings::python::GetPrintableParam | ( | 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.
std::string mlpack::bindings::python::GetPrintableParam | ( | 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.
std::string mlpack::bindings::python::GetPrintableParam | ( | 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.
std::string mlpack::bindings::python::GetPrintableParam | ( | 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.
std::string mlpack::bindings::python::GetPrintableParam | ( | 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.
void mlpack::bindings::python::GetPrintableParam | ( | 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.
data | Parameter data struct. |
* | (input) Unused parameter. |
output | Output storage for the string. |
Definition at line 114 of file get_printable_param.hpp.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
void mlpack::bindings::python::GetPrintableType | ( | util::ParamData & | d, |
const void * | , | ||
void * | output | ||
) |
Definition at line 106 of file get_printable_type.hpp.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
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.
|
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.
|
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.
void mlpack::bindings::python::ImportDecl | ( | 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().
void mlpack::bindings::python::ImportDecl | ( | 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.
void mlpack::bindings::python::ImportDecl | ( | 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.
void mlpack::bindings::python::ImportDecl | ( | util::ParamData & | d, |
const void * | indent, | ||
void * | |||
) |
Print the cppclass definition for a serializable model; print nothing for a non-serializable type.
d | Parameter info struct. |
indent | Pointer to size_t indicating indent. |
* | (output) Unused parameter. |
Definition at line 83 of file import_decl.hpp.
|
inline |
Given the parameter name, determine what it would actually be when passed to the command line.
void mlpack::bindings::python::PrintClassDefn | ( | 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.
void mlpack::bindings::python::PrintClassDefn | ( | 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.
void mlpack::bindings::python::PrintClassDefn | ( | 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:
Definition at line 49 of file print_class_defn.hpp.
References ParamData::cppType, and StripType().
void mlpack::bindings::python::PrintClassDefn | ( | 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.
d | Parameter data. |
* | (input) Unused parameter. |
* | (output) Unused parameter. |
Definition at line 114 of file print_class_defn.hpp.
|
inline |
Given the name of a matrix, print it.
Here we do not need to modify anything.
|
inline |
Given a parameter name, print its corresponding default value.
void mlpack::bindings::python::PrintDefn | ( | 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 if(), ParamData::name, and ParamData::required.
void mlpack::bindings::python::PrintDoc | ( | 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.
d | Parameter data struct. |
input | Pointer to size_t containing indent. |
* | (output) Unused parameter. |
Definition at line 36 of file print_doc.hpp.
References ParamData::cppType, ParamData::desc, mlpack::util::HyphenateString(), if(), ParamData::name, and ParamData::required.
|
inline |
Print any import information for the Python binding.
|
inline |
Print any special information about input options.
|
inline |
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 IO. For a parameter 'x' with value '5', this will print something like x=5.
void mlpack::bindings::python::PrintInputProcessing | ( | 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:
if param_name is not None: if isinstance(param_name, int): SetParam[int](
Definition at line 31 of file print_input_processing.hpp.
References if(), ParamData::name, and ParamData::required.
void mlpack::bindings::python::PrintInputProcessing | ( | 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]](
Definition at line 164 of file print_input_processing.hpp.
References if(), ParamData::name, and ParamData::required.
void mlpack::bindings::python::PrintInputProcessing | ( | 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:
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](
Definition at line 251 of file print_input_processing.hpp.
References ParamData::name, and ParamData::required.
void mlpack::bindings::python::PrintInputProcessing | ( | 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:
if param_name is not None: try: SetParamPtr[Model]('param_name', (
Definition at line 372 of file print_input_processing.hpp.
References ParamData::cppType, ParamData::name, ParamData::required, and StripType().
void mlpack::bindings::python::PrintInputProcessing | ( | 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](
Definition at line 445 of file print_input_processing.hpp.
References ParamData::name, and ParamData::required.
void mlpack::bindings::python::PrintInputProcessing | ( | 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.
d | Parameter data struct. |
input | Pointer to size_t holding the indentation. |
* | (output) Unused parameter. |
Definition at line 525 of file print_input_processing.hpp.
|
inline |
Given the name of a model, print it.
Here we do not need to modify anything.
|
inline |
Print any special information about output options.
|
inline |
std::string mlpack::bindings::python::PrintOutputOptions | ( | const std::string & | paramName, |
const T & | value, | ||
Args... | args | ||
) |
void mlpack::bindings::python::PrintOutputProcessing | ( | 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 = IO.GetParam[int]('param_name')
This gives us code like:
result['param_name'] = IO.GetParam[int]('param_name')
Definition at line 29 of file print_output_processing.hpp.
References if(), and ParamData::name.
void mlpack::bindings::python::PrintOutputProcessing | ( | 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(IO.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(IO.GetParam[mat]('name')
where X indicates the type to convert to.
Definition at line 85 of file print_output_processing.hpp.
References ParamData::name.
void mlpack::bindings::python::PrintOutputProcessing | ( | 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.
void mlpack::bindings::python::PrintOutputProcessing | ( | 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() (
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() (
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, IO::Parameters(), ParamData::required, and StripType().
void mlpack::bindings::python::PrintOutputProcessing | ( | 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
d | Parameter data struct. |
input | Pointer to size_t holding the indentation. |
* | (output) Unused parameter. |
Definition at line 298 of file print_output_processing.hpp.
void mlpack::bindings::python::PrintPYX | ( | const util::BindingDetails & | doc, |
const std::string & | mainFilename, | ||
const std::string & | functionName | ||
) |
Given a list of parameter definition and program documentation, print a generated .pyx file to stdout.
doc | Documentation for the program. |
mainFilename | Filename of the main program (i.e. "/path/to/pca_main.cpp"). |
functionName | Name of the function (i.e. "pca"). |
std::string mlpack::bindings::python::PrintTypeDoc | ( | 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.
std::string mlpack::bindings::python::PrintTypeDoc | ( | 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.
std::string mlpack::bindings::python::PrintTypeDoc | ( | 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.
std::string mlpack::bindings::python::PrintTypeDoc | ( | 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.
std::string mlpack::bindings::python::PrintTypeDoc | ( | 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.
void mlpack::bindings::python::PrintTypeDoc | ( | 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.
|
inline |
Given a parameter type, print the corresponding value.
|
inline |
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.
|
inline |
Given the name of a binding, print a program call assuming that all options are specified.
void mlpack::bindings::python::SerializeIn | ( | T * | t, |
const std::string & | str, | ||
const std::string & | name | ||
) |
Definition at line 34 of file serialization.hpp.
std::string mlpack::bindings::python::SerializeOut | ( | T * | t, |
const std::string & | name | ||
) |
Definition at line 22 of file serialization.hpp.
|
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().
std::string programName |