mlpack_main.hpp
Go to the documentation of this file.
1 
9 #ifndef MLPACK_BINDINGS_PYTHON_MLPACK_MAIN_HPP
10 #define MLPACK_BINDINGS_PYTHON_MLPACK_MAIN_HPP
11 
12 #ifndef BINDING_TYPE
13  #error "BINDING_TYPE not defined! Don't include this file directly!"
14 #endif
15 #if BINDING_TYPE != BINDING_TYPE_PYX
16  #error "BINDING_TYPE is not set to BINDING_TYPE_PYX!"
17 #endif
18 
19 // Matrices are transposed on load/save.
20 #define BINDING_MATRIX_TRANSPOSED true
21 
24 
29 #define PRINT_PARAM_STRING mlpack::bindings::python::ParamString
30 
35 #define PRINT_PARAM_VALUE mlpack::bindings::python::PrintValue
36 
41 #define PRINT_DATASET mlpack::bindings::python::PrintDataset
42 
47 #define PRINT_MODEL mlpack::bindings::python::PrintModel
48 
53 #define IMPORT_EXT_LIB mlpack::bindings::python::ImportExtLib
54 
58 #define IMPORT_SPLIT mlpack::bindings::python::ImportSplit
59 
63 #define IMPORT_THIS mlpack::bindings::python::ImportThis
64 
69 #define GET_DATASET mlpack::bindings::python::GetDataset
70 
74 #define SPLIT_TRAIN_TEST mlpack::bindings::python::SplitTrainTest
75 
80 #define CREATE_OBJECT(...) mlpack::bindings::python::CreateObject(\
81  STRINGIFY(BINDING_NAME), __VA_ARGS__)
82 
86 #define CALL_METHOD(...) mlpack::bindings::python::CallMethod(\
87  STRINGIFY(BINDING_NAME), __VA_ARGS__)
88 
96 #define PRINT_CALL mlpack::bindings::python::ProgramCall
97 
102 #define BINDING_IGNORE_CHECK(x) mlpack::bindings::python::IgnoreCheck( \
103  STRINGIFY(BINDING_NAME), x)
104 
105 namespace mlpack {
106 namespace util {
107 
108 template<typename T>
110 
111 }
112 }
113 
115 
116 // In Python, we want to call the binding function mlpack_<BINDING_NAME>()
117 // instead of just <BINDING_NAME>(), so we change the definition of
118 // BINDING_FUNCTION().
119 #undef BINDING_FUNCTION
120 #define BINDING_FUNCTION(...) JOIN(mlpack_, BINDING_NAME)(__VA_ARGS__)
121 
122 // Define parameters available in every Python binding.
123 PARAM_GLOBAL(bool, "verbose", "Display informational messages and the full "
124  "list of parameters and timers at the end of execution.", "v", "bool",
125  false, true, false, false);
126 PARAM_GLOBAL(bool, "copy_all_inputs", "If specified, all input parameters "
127  "will be deep copied before the method is run. This is useful for "
128  "debugging problems where the input parameters are being modified "
129  "by the algorithm, but can slow down the code.", "", "bool",
130  false, true, false, false);
131 PARAM_GLOBAL(bool, "check_input_matrices", "If specified, the input matrix "
132  "is checked for NaN and inf values; an exception is thrown if any are "
133  "found.", "", "bool", false, true, false, false);
134 
135 #endif
Linear algebra utility functions, generally performed on matrices or vectors.
mlpack::bindings::cli::CLIOption< T > Option
Definition: mlpack_main.hpp:70
The Python option class.
Definition: py_option.hpp:35
PARAM_GLOBAL(bool, "help", "Default help info.", "h", "bool", false, true, false, false)