Classes | |
class | PyOption |
The Python option class. More... | |
Functions | |
template<typename... Args> | |
std::string | CallMethod (const std::string &bindingName, const std::string &objectName, const std::string &methodName, Args... args) |
template<typename... Args> | |
std::string | CreateObject (const std::string &bindingName, const std::string &objectName, const std::string &groupName, Args... args) |
std::string | CreateObject (const std::string &bindingName, const std::string &objectName, const std::string &groupName) |
template < typename T > | |
void | DefaultParam (util::ParamData &data, const void *, void *output) |
Return the default value of an option. More... | |
template < typename T > | |
std::string | DefaultParamImpl (util::ParamData &data, const typename std::enable_if<!arma::is_arma_type< T >::value >::type *=0, const typename std::enable_if<!util::IsStdVector< T >::value >::type *=0, const typename std::enable_if<!data::HasSerialize< T >::value >::type *=0, const typename std::enable_if<!std::is_same< T, std::string >::value >::type *=0, const typename std::enable_if<!std::is_same< T, std::tuple< mlpack::data::DatasetInfo, arma::mat >>::value >::type *=0) |
Return the default value of an option. More... | |
template < typename T > | |
std::string | DefaultParamImpl (util::ParamData &data, const typename std::enable_if< util::IsStdVector< T >::value >::type *=0) |
Return the default value of a vector option. More... | |
template < typename T > | |
std::string | DefaultParamImpl (util::ParamData &data, const typename std::enable_if< std::is_same< T, std::string >::value >::type *=0) |
Return the default value of a string option. More... | |
template < typename T > | |
std::string | DefaultParamImpl (util::ParamData &data, const typename std::enable_if< 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 (util::ParamData &data, const typename std::enable_if<!arma::is_arma_type< T >::value >::type *=0, const typename std::enable_if< data::HasSerialize< T >::value >::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... | |
std::string | GetClassName (const std::string &groupName) |
template < typename T > | |
std::string | GetCythonType (util::ParamData &, const typename std::enable_if<!util::IsStdVector< T >::value >::type *=0, const typename std::enable_if<!data::HasSerialize< T >::value >::type *=0, const typename std::enable_if<!arma::is_arma_type< T >::value >::type *=0) |
template < typename T > | |
std::string | GetCythonType (util::ParamData &d, const typename std::enable_if< util::IsStdVector< T >::value >::type *=0) |
template < typename T > | |
std::string | GetCythonType (util::ParamData &d, const typename std::enable_if< arma::is_arma_type< T >::value >::type *=0) |
template < typename T > | |
std::string | GetCythonType (util::ParamData &d, const typename std::enable_if<!arma::is_arma_type< T >::value >::type *=0, const typename std::enable_if< data::HasSerialize< T >::value >::type *=0) |
template < > | |
std::string | GetCythonType< bool > (util::ParamData &, const typename std::enable_if<!util::IsStdVector< bool >::value >::type *, const typename std::enable_if<!data::HasSerialize< bool >::value >::type *, const typename std::enable_if<!arma::is_arma_type< bool >::value >::type *) |
template < > | |
std::string | GetCythonType< double > (util::ParamData &, const typename std::enable_if<!util::IsStdVector< double >::value >::type *, const typename std::enable_if<!data::HasSerialize< double >::value >::type *, const typename std::enable_if<!arma::is_arma_type< double >::value >::type *) |
template < > | |
std::string | GetCythonType< int > (util::ParamData &, const typename std::enable_if<!util::IsStdVector< int >::value >::type *, const typename std::enable_if<!data::HasSerialize< int >::value >::type *, const typename std::enable_if<!arma::is_arma_type< int >::value >::type *) |
template < > | |
std::string | GetCythonType< size_t > (util::ParamData &, const typename std::enable_if<!util::IsStdVector< size_t >::value >::type *, const typename std::enable_if<!data::HasSerialize< size_t >::value >::type *, const typename std::enable_if<!arma::is_arma_type< size_t >::value >::type *) |
template < > | |
std::string | GetCythonType< std::string > (util::ParamData &, const typename std::enable_if< !util::IsStdVector< std::string >::value >::type *, const typename std::enable_if< !data::HasSerialize< std::string >::value >::type *, const typename std::enable_if< !arma::is_arma_type< std::string >::value >::type *) |
std::string | GetDataset (const std::string &datasetName, const std::string &url) |
std::string | GetMappedName (const std::string &methodName) |
std::vector< std::string > | GetMethods (const std::string &validMethods) |
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 (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 (util::ParamData &data, const typename std::enable_if<!arma::is_arma_type< T >::value >::type *=0, const typename std::enable_if<!util::IsStdVector< T >::value >::type *=0, const typename std::enable_if<!data::HasSerialize< T >::value >::type *=0, const typename std::enable_if<!std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>::value >::type *=0) |
Print an option of a simple type. More... | |
template < typename T > | |
std::string | GetPrintableParam (util::ParamData &data, const typename std::enable_if< util::IsStdVector< T >::value >::type *=0) |
Print a vector option, with spaces between it. More... | |
template < typename T > | |
std::string | GetPrintableParam (util::ParamData &data, const typename std::enable_if< arma::is_arma_type< T >::value >::type *=0) |
Print a matrix option (this prints its size). More... | |
template < typename T > | |
std::string | GetPrintableParam (util::ParamData &data, const typename std::enable_if<!arma::is_arma_type< T >::value >::type *=0, const typename std::enable_if< data::HasSerialize< T >::value >::type *=0) |
Print a serializable class option (this prints the class name). More... | |
template < typename T > | |
std::string | GetPrintableParam (util::ParamData &data, const typename std::enable_if< std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>::value >::type *=0) |
Print a combination DatasetInfo/matrix parameter. More... | |
template < typename T > | |
void | GetPrintableParam (util::ParamData &data, const void *, void *output) |
Print an option into a std::string. More... | |
template < typename T > | |
std::string | GetPrintableType (util::ParamData &, const typename std::enable_if<!util::IsStdVector< T >::value >::type *=0, const typename std::enable_if<!data::HasSerialize< T >::value >::type *=0, const typename std::enable_if<!arma::is_arma_type< T >::value >::type *=0, const typename std::enable_if<!std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>::value >::type *=0) |
template < typename T > | |
std::string | GetPrintableType (util::ParamData &d, const typename std::enable_if< util::IsStdVector< T >::value >::type *=0, const typename std::enable_if<!std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>::value >::type *=0) |
template < typename T > | |
std::string | GetPrintableType (util::ParamData &, const typename std::enable_if< arma::is_arma_type< T >::value >::type *=0, const typename std::enable_if<!std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>::value >::type *=0) |
template < typename T > | |
std::string | GetPrintableType (util::ParamData &, const typename std::enable_if< std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>::value >::type *=0) |
template < typename T > | |
std::string | GetPrintableType (util::ParamData &d, const typename std::enable_if<!arma::is_arma_type< T >::value >::type *=0, const typename std::enable_if< data::HasSerialize< T >::value >::type *=0, const typename std::enable_if<!std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>::value >::type *=0) |
template < typename T > | |
void | GetPrintableType (util::ParamData &d, const void *, void *output) |
template < > | |
std::string | GetPrintableType< bool > (util::ParamData &, const typename std::enable_if<!util::IsStdVector< bool >::value >::type *, const typename std::enable_if<!data::HasSerialize< bool >::value >::type *, const typename std::enable_if<!arma::is_arma_type< bool >::value >::type *, const typename std::enable_if<!std::is_same< bool, std::tuple< data::DatasetInfo, arma::mat >>::value >::type *) |
template < > | |
std::string | GetPrintableType< double > (util::ParamData &, const typename std::enable_if<!util::IsStdVector< double >::value >::type *, const typename std::enable_if<!data::HasSerialize< double >::value >::type *, const typename std::enable_if<!arma::is_arma_type< double >::value >::type *, const typename std::enable_if<!std::is_same< double, std::tuple< data::DatasetInfo, arma::mat >>::value >::type *) |
template < > | |
std::string | GetPrintableType< int > (util::ParamData &, const typename std::enable_if<!util::IsStdVector< int >::value >::type *, const typename std::enable_if<!data::HasSerialize< int >::value >::type *, const typename std::enable_if<!arma::is_arma_type< int >::value >::type *, const typename std::enable_if<!std::is_same< int, std::tuple< data::DatasetInfo, arma::mat >>::value >::type *) |
template < > | |
std::string | GetPrintableType< size_t > (util::ParamData &, const typename std::enable_if<!util::IsStdVector< size_t >::value >::type *, const typename std::enable_if<!data::HasSerialize< size_t >::value >::type *, const typename std::enable_if<!arma::is_arma_type< size_t >::value >::type *, const typename std::enable_if<!std::is_same< size_t, std::tuple< data::DatasetInfo, arma::mat >>::value >::type *) |
template < > | |
std::string | GetPrintableType< std::string > (util::ParamData &, const typename std::enable_if< !util::IsStdVector< std::string >::value >::type *, const typename std::enable_if< !data::HasSerialize< std::string >::value >::type *, const typename std::enable_if< !arma::is_arma_type< std::string >::value >::type *, const typename std::enable_if<!std::is_same< std::string, std::tuple< data::DatasetInfo, arma::mat >>::value >::type *) |
std::string | GetValidName (const std::string ¶mName) |
bool | IgnoreCheck (const std::string &bindingName, const std::string ¶mName) |
Print whether or not we should ignore a check on the given parameter. More... | |
bool | IgnoreCheck (const std::string &bindingName, 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::string &bindingName, 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 < typename T > | |
void | ImportDecl (util::ParamData &d, const size_t indent, const typename std::enable_if<!arma::is_arma_type< T >::value >::type *=0, const typename std::enable_if< data::HasSerialize< T >::value >::type *=0) |
For a serializable type, print a cppclass definition. More... | |
template < typename T > | |
void | ImportDecl (util::ParamData &, const size_t, const typename std::enable_if<!arma::is_arma_type< T >::value >::type *=0, const typename std::enable_if<!data::HasSerialize< T >::value >::type *=0) |
For a non-serializable type, print nothing. More... | |
template < typename T > | |
void | ImportDecl (util::ParamData &, const size_t, const typename std::enable_if< arma::is_arma_type< T >::value >::type *=0) |
For a matrix type, print nothing. More... | |
template < typename T > | |
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 | ImportExtLib () |
std::string | ImportSplit () |
std::string | ImportThis (const std::string &groupName) |
template < typename T > | |
bool | IsSerializable (util::ParamData &, const typename boost::disable_if< data::HasSerialize< T >>::type *=0) |
template < typename T > | |
bool | IsSerializable (util::ParamData &, const typename boost::enable_if< data::HasSerialize< T >>::type *=0) |
template < typename T > | |
void | IsSerializable (util::ParamData &data, const void *, void *output) |
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 < typename T > | |
void | PrintClassDefn (util::ParamData &, const typename std::enable_if<!arma::is_arma_type< T >::value >::type *=0, const typename std::enable_if<!data::HasSerialize< T >::value >::type *=0) |
Non-serializable models don't require any special definitions, so this prints nothing. More... | |
template < typename T > | |
void | PrintClassDefn (util::ParamData &, const typename std::enable_if< arma::is_arma_type< T >::value >::type *=0) |
Matrices don't require any special definitions, so this prints nothing. More... | |
template < typename T > | |
void | PrintClassDefn (util::ParamData &d, const typename std::enable_if<!arma::is_arma_type< T >::value >::type *=0, const typename std::enable_if< data::HasSerialize< T >::value >::type *=0) |
Serializable models require a special class definition. More... | |
template < typename T > | |
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 &bindingName, const std::string ¶mName) |
Given a parameter name, print its corresponding default value. More... | |
template < typename T > | |
void | PrintDefn (util::ParamData &d, const void *, void *) |
Print the definition for a Python binding parameter to stdout. More... | |
template < typename T > | |
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 (util::Params ¶ms, bool onlyHyperParams, bool onlyMatrixParams) |
template<typename T , typename... Args> | |
std::string | PrintInputOptions (util::Params ¶ms, bool onlyHyperParams, bool onlyMatrixParams, const std::string ¶mName, const T &value, Args... args) |
Print an input option. More... | |
template < typename T > | |
void | PrintInputProcessing (util::ParamData &d, const size_t indent, const typename std::enable_if<!util::IsStdVector< T >::value >::type *=0, const typename std::enable_if<!arma::is_arma_type< T >::value >::type *=0, const typename std::enable_if<!data::HasSerialize< T >::value >::type *=0, const typename std::enable_if<!std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>::value >::type *=0) |
Print input processing for a standard option type. More... | |
template < typename T > | |
void | PrintInputProcessing (util::ParamData &d, const size_t indent, const typename std::enable_if<!arma::is_arma_type< T >::value >::type *=0, const typename std::enable_if<!data::HasSerialize< T >::value >::type *=0, const typename std::enable_if<!std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>::value >::type *=0, const typename std::enable_if< util::IsStdVector< T >::value >::type *=0) |
Print input processing for a vector type. More... | |
template < typename T > | |
void | PrintInputProcessing (util::ParamData &d, const size_t indent, const typename std::enable_if<!util::IsStdVector< T >::value >::type *=0, const typename std::enable_if< arma::is_arma_type< T >::value >::type *=0) |
Print input processing for a matrix type. More... | |
template < typename T > | |
void | PrintInputProcessing (util::ParamData &d, const size_t indent, const typename std::enable_if<!util::IsStdVector< T >::value >::type *=0, const typename std::enable_if<!arma::is_arma_type< T >::value >::type *=0, const typename std::enable_if< data::HasSerialize< T >::value >::type *=0) |
Print input processing for a serializable type. More... | |
template < typename T > | |
void | PrintInputProcessing (util::ParamData &d, const size_t indent, const typename std::enable_if<!util::IsStdVector< T >::value >::type *=0, const typename std::enable_if< std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>::value >::type *=0) |
Print input processing for a matrix/DatasetInfo type. More... | |
template < typename T > | |
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 (util::Params ¶ms) |
template<typename T , typename... Args> | |
std::string | PrintOutputOptions (util::Params ¶ms, const std::string ¶mName, const T &value, Args... args) |
template < typename T > | |
void | PrintOutputProcessing (util::Params &, util::ParamData &d, const size_t indent, const bool onlyOutput, const typename std::enable_if<!arma::is_arma_type< T >::value >::type *=0, const typename std::enable_if<!data::HasSerialize< T >::value >::type *=0, const typename std::enable_if<!std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>::value >::type *=0) |
Print output processing for a regular parameter type. More... | |
template < typename T > | |
void | PrintOutputProcessing (util::Params &, util::ParamData &d, const size_t indent, const bool onlyOutput, const typename std::enable_if< arma::is_arma_type< T >::value >::type *=0) |
Print output processing for a matrix type. More... | |
template < typename T > | |
void | PrintOutputProcessing (util::Params &, util::ParamData &d, const size_t indent, const bool onlyOutput, const typename std::enable_if< std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>::value >::type *=0) |
Print output processing for a dataset info / matrix combination. More... | |
template < typename T > | |
void | PrintOutputProcessing (util::Params ¶ms, util::ParamData &d, const size_t indent, const bool onlyOutput, const typename std::enable_if<!arma::is_arma_type< T >::value >::type *=0, const typename std::enable_if< data::HasSerialize< T >::value >::type *=0) |
Print output processing for a serializable model. More... | |
template < typename T > | |
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 < typename T > | |
std::string | PrintTypeDoc (util::ParamData &data, const typename std::enable_if<!arma::is_arma_type< T >::value >::type *=0, const typename std::enable_if<!util::IsStdVector< T >::value >::type *=0, const typename std::enable_if<!data::HasSerialize< T >::value >::type *=0, 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 an option. More... | |
template < typename T > | |
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 < typename T > | |
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 < typename T > | |
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 < typename T > | |
std::string | PrintTypeDoc (util::ParamData &data, const typename std::enable_if<!arma::is_arma_type< T >::value >::type *=0, const typename std::enable_if< data::HasSerialize< T >::value >::type *=0) |
Return a string representing the command-line type of a model. More... | |
template < typename T > | |
void | PrintTypeDoc (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) |
void | PrintWrapperPY (const std::string &category, const std::string &groupName, const std::string &validMethods) |
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 (util::Params &p, 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 > | |
void | SerializeInJSON (T *t, const std::string &str, const std::string &name) |
template < typename T > | |
std::string | SerializeOut (T *t, const std::string &name) |
template < typename T > | |
std::string | SerializeOutJSON (T *t, const std::string &name) |
std::string | SplitTrainTest (const std::string &datasetName, const std::string &labelName, const std::string &trainDataset, const std::string &trainLabels, const std::string &testDataset, const std::string &testLabels, const std::string &splitRatio) |
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... | |
std::string mlpack::bindings::python::CallMethod | ( | const std::string & | bindingName, |
const std::string & | objectName, | ||
const std::string & | methodName, | ||
Args... | args | ||
) |
std::string mlpack::bindings::python::CreateObject | ( | const std::string & | bindingName, |
const std::string & | objectName, | ||
const std::string & | groupName, | ||
Args... | args | ||
) |
|
inline |
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 81 of file default_param.hpp.
std::string mlpack::bindings::python::DefaultParamImpl | ( | util::ParamData & | data, |
const typename std::enable_if<!arma::is_arma_type< T >::value >::type * | = 0 , |
||
const typename std::enable_if<!util::IsStdVector< T >::value >::type * | = 0 , |
||
const typename std::enable_if<!data::HasSerialize< T >::value >::type * | = 0 , |
||
const typename std::enable_if<!std::is_same< T, std::string >::value >::type * | = 0 , |
||
const typename std::enable_if<!std::is_same< T, std::tuple< mlpack::data::DatasetInfo, arma::mat >>::value >::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 std::enable_if< util::IsStdVector< T >::value >::type * | = 0 |
||
) |
Return the default value of a vector option.
std::string mlpack::bindings::python::DefaultParamImpl | ( | util::ParamData & | data, |
const typename std::enable_if< std::is_same< T, std::string >::value >::type * | = 0 |
||
) |
Return the default value of a string option.
std::string mlpack::bindings::python::DefaultParamImpl | ( | util::ParamData & | data, |
const typename std::enable_if< 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 std::enable_if<!arma::is_arma_type< T >::value >::type * | = 0 , |
||
const typename std::enable_if< data::HasSerialize< T >::value >::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 |
|
inline |
Definition at line 24 of file get_cython_type.hpp.
|
inline |
Definition at line 87 of file get_cython_type.hpp.
|
inline |
Definition at line 95 of file get_cython_type.hpp.
|
inline |
Definition at line 109 of file get_cython_type.hpp.
References ParamData::cppType.
|
inline |
Definition at line 77 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 67 of file get_cython_type.hpp.
|
inline |
Definition at line 54 of file get_cython_type.hpp.
|
inline |
|
inline |
|
inline |
|
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 std::enable_if<!arma::is_arma_type< T >::value >::type * | = 0 , |
||
const typename std::enable_if<!util::IsStdVector< T >::value >::type * | = 0 , |
||
const typename std::enable_if<!data::HasSerialize< T >::value >::type * | = 0 , |
||
const typename std::enable_if<!std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>::value >::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 std::enable_if< util::IsStdVector< T >::value >::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 std::enable_if< arma::is_arma_type< T >::value >::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 std::enable_if<!arma::is_arma_type< T >::value >::type * | = 0 , |
||
const typename std::enable_if< data::HasSerialize< T >::value >::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 std::enable_if< std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>::value >::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 109 of file get_printable_type.hpp.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Referenced by PrintDefn(), and PrintInputProcessing().
|
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 std::enable_if<!arma::is_arma_type< T >::value >::type * | = 0 , |
||
const typename std::enable_if< data::HasSerialize< T >::value >::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 std::enable_if<!arma::is_arma_type< T >::value >::type * | = 0 , |
||
const typename std::enable_if<!data::HasSerialize< T >::value >::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 std::enable_if< arma::is_arma_type< T >::value >::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 |
|
inline |
|
inline |
|
inline |
Definition at line 22 of file is_serializable.hpp.
|
inline |
Definition at line 30 of file is_serializable.hpp.
void mlpack::bindings::python::IsSerializable | ( | util::ParamData & | data, |
const void * | , | ||
void * | output | ||
) |
Definition at line 38 of file is_serializable.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 std::enable_if<!arma::is_arma_type< T >::value >::type * | = 0 , |
||
const typename std::enable_if<!data::HasSerialize< T >::value >::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 std::enable_if< arma::is_arma_type< T >::value >::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 std::enable_if<!arma::is_arma_type< T >::value >::type * | = 0 , |
||
const typename std::enable_if< data::HasSerialize< T >::value >::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 152 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 27 of file print_defn.hpp.
References GetValidName(), 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 | ( | util::Params & | params, |
bool | onlyHyperParams, | ||
bool | onlyMatrixParams, | ||
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 std::enable_if<!util::IsStdVector< T >::value >::type * | = 0 , |
||
const typename std::enable_if<!arma::is_arma_type< T >::value >::type * | = 0 , |
||
const typename std::enable_if<!data::HasSerialize< T >::value >::type * | = 0 , |
||
const typename std::enable_if<!std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>::value >::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](p, <const string> 'param_name', param_name) p.SetPassed(<const string> 'param_name') else: raise TypeError("'param_name' must have type 'list'!")
Definition at line 32 of file print_input_processing.hpp.
References GetValidName(), if(), ParamData::name, and ParamData::required.
void mlpack::bindings::python::PrintInputProcessing | ( | util::ParamData & | d, |
const size_t | indent, | ||
const typename std::enable_if<!arma::is_arma_type< T >::value >::type * | = 0 , |
||
const typename std::enable_if<!data::HasSerialize< T >::value >::type * | = 0 , |
||
const typename std::enable_if<!std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>::value >::type * | = 0 , |
||
const typename std::enable_if< util::IsStdVector< T >::value >::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]](p, <const string> 'param_name', param_name) p.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 165 of file print_input_processing.hpp.
References GetValidName(), if(), ParamData::name, and ParamData::required.
void mlpack::bindings::python::PrintInputProcessing | ( | util::ParamData & | d, |
const size_t | indent, | ||
const typename std::enable_if<!util::IsStdVector< T >::value >::type * | = 0 , |
||
const typename std::enable_if< arma::is_arma_type< T >::value >::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](p, <const string> 'param_name', dereference(param_name_mat)) p.SetPassed(<const string> 'param_name')
Definition at line 255 of file print_input_processing.hpp.
References GetValidName(), ParamData::name, and ParamData::required.
void mlpack::bindings::python::PrintInputProcessing | ( | util::ParamData & | d, |
const size_t | indent, | ||
const typename std::enable_if<!util::IsStdVector< T >::value >::type * | = 0 , |
||
const typename std::enable_if<!arma::is_arma_type< T >::value >::type * | = 0 , |
||
const typename std::enable_if< data::HasSerialize< T >::value >::type * | = 0 |
||
) |
Print input processing for a serializable type.
This gives us code like:
if param_name is not None: try: SetParamPtr[Model](p, 'param_name', (<ModelType?> param_name).modelptr, p.Has('copy_all_inputs')) except TypeError as e: if type(param_name).__name__ == "ModelType": SetParamPtr[Model](p, 'param_name', (<ModelType> param_name).modelptr, p.Has('copy_all_inputs')) else: raise e p.SetPassed(<const string>=""> 'param_name')
Definition at line 378 of file print_input_processing.hpp.
References ParamData::cppType, GetValidName(), ParamData::name, ParamData::required, and StripType().
void mlpack::bindings::python::PrintInputProcessing | ( | util::ParamData & | d, |
const size_t | indent, | ||
const typename std::enable_if<!util::IsStdVector< T >::value >::type * | = 0 , |
||
const typename std::enable_if< std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>::value >::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](p, <const string> 'param_name', dereference(param_name_mat), ¶m_name_tuple[1][0]) p.SetPassed(<const string> 'param_name')
Definition at line 453 of file print_input_processing.hpp.
References GetValidName(), 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 535 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 | ( | util::Params & | params, |
const std::string & | paramName, | ||
const T & | value, | ||
Args... | args | ||
) |
void mlpack::bindings::python::PrintOutputProcessing | ( | util::Params & | , |
util::ParamData & | d, | ||
const size_t | indent, | ||
const bool | onlyOutput, | ||
const typename std::enable_if<!arma::is_arma_type< T >::value >::type * | = 0 , |
||
const typename std::enable_if<!data::HasSerialize< T >::value >::type * | = 0 , |
||
const typename std::enable_if<!std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>::value >::type * | = 0 |
||
) |
Print output processing for a regular parameter type.
This gives us code like:
result = p.Get[int]('param_name')
This gives us code like:
result['param_name'] = p.Get[int]('param_name')
Definition at line 29 of file print_output_processing.hpp.
References if(), and ParamData::name.
void mlpack::bindings::python::PrintOutputProcessing | ( | util::Params & | , |
util::ParamData & | d, | ||
const size_t | indent, | ||
const bool | onlyOutput, | ||
const typename std::enable_if< arma::is_arma_type< T >::value >::type * | = 0 |
||
) |
Print output processing for a matrix type.
This gives us code like:
result = arma_numpy.mat_to_numpy_X(p.Get[mat]("name"))
where X indicates the type to convert to.
This gives us code like:
result['param_name'] = arma_numpy.mat_to_numpy_X(p.Get[mat]('name')
where X indicates the type to convert to.
Definition at line 86 of file print_output_processing.hpp.
References ParamData::name.
void mlpack::bindings::python::PrintOutputProcessing | ( | util::Params & | , |
util::ParamData & | d, | ||
const size_t | indent, | ||
const bool | onlyOutput, | ||
const typename std::enable_if< std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>::value >::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](p, 'name'))
This gives us code like:
result['param_name'] = arma_numpy.mat_to_numpy_X(GetParamWithInfo[mat](p, 'name'))
Definition at line 129 of file print_output_processing.hpp.
References ParamData::name.
void mlpack::bindings::python::PrintOutputProcessing | ( | util::Params & | params, |
util::ParamData & | d, | ||
const size_t | indent, | ||
const bool | onlyOutput, | ||
const typename std::enable_if<!arma::is_arma_type< T >::value >::type * | = 0 , |
||
const typename std::enable_if< data::HasSerialize< T >::value >::type * | = 0 |
||
) |
Print output processing for a serializable model.
This gives us code like:
result = ModelType() (<ModelType?> result).modelptr = GetParamPtr[Model](p, '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](p, '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 172 of file print_output_processing.hpp.
References ParamData::cppType, ParamData::input, ParamData::name, Params::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<util::Params, std::tuple<size_t, bool>> where the first element is the parameters of the binding and the second element is a tuple where the first element is the indentation and the second element is a boolean representing whether or not this is the only output parameter.
d | Parameter data struct. |
input | Pointer to size_t holding the indentation. |
* | (output) Unused parameter. |
Definition at line 304 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 std::enable_if<!arma::is_arma_type< T >::value >::type * | = 0 , |
||
const typename std::enable_if<!util::IsStdVector< T >::value >::type * | = 0 , |
||
const typename std::enable_if<!data::HasSerialize< T >::value >::type * | = 0 , |
||
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 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 std::enable_if<!arma::is_arma_type< T >::value >::type * | = 0 , |
||
const typename std::enable_if< data::HasSerialize< T >::value >::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 |
void mlpack::bindings::python::PrintWrapperPY | ( | const std::string & | category, |
const std::string & | groupName, | ||
const std::string & | validMethods | ||
) |
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.
void mlpack::bindings::python::SerializeInJSON | ( | T * | t, |
const std::string & | str, | ||
const std::string & | name | ||
) |
Definition at line 54 of file serialization.hpp.
std::string mlpack::bindings::python::SerializeOut | ( | T * | t, |
const std::string & | name | ||
) |
Definition at line 22 of file serialization.hpp.
std::string mlpack::bindings::python::SerializeOutJSON | ( | T * | t, |
const std::string & | name | ||
) |
Definition at line 42 of file serialization.hpp.
|
inline |
|
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().