mlpack  3.1.1
add_to_po.hpp
Go to the documentation of this file.
1 
13 #ifndef MLPACK_BINDINGS_CLI_ADD_TO_PO_HPP
14 #define MLPACK_BINDINGS_CLI_ADD_TO_PO_HPP
15 
17 #include <boost/program_options.hpp>
19 #include "map_parameter_name.hpp"
20 
21 namespace mlpack {
22 namespace bindings {
23 namespace cli {
24 
32 template<typename T>
33 void AddToPO(const std::string& boostName,
34  const std::string& descr,
35  boost::program_options::options_description& desc,
36  const typename boost::disable_if<util::IsStdVector<T>>::type* = 0,
37  const typename boost::disable_if<std::is_same<T, bool>>::type* = 0)
38 {
39  desc.add_options()(boostName.c_str(), boost::program_options::value<T>(),
40  descr.c_str());
41 }
42 
51 template<typename T>
52 void AddToPO(const std::string& boostName,
53  const std::string& descr,
54  boost::program_options::options_description& desc,
55  const typename boost::enable_if<util::IsStdVector<T>>::type* = 0,
56  const typename boost::disable_if<std::is_same<T, bool>>::type* = 0)
57 {
58  desc.add_options()(boostName.c_str(),
59  boost::program_options::value<T>()->multitoken(), descr.c_str());
60 }
61 
69 template<typename T>
70 void AddToPO(const std::string& boostName,
71  const std::string& descr,
72  boost::program_options::options_description& desc,
73  const typename boost::disable_if<util::IsStdVector<T>>::type* = 0,
74  const typename boost::enable_if<std::is_same<T, bool>>::type* = 0)
75 {
76  desc.add_options()(boostName.c_str(), descr.c_str());
77 }
78 
87 template<typename T>
88 void AddToPO(const util::ParamData& d,
89  const void* /* input */,
90  void* output)
91 {
92  // Cast boost::program_options::options_description object.
93  boost::program_options::options_description* desc =
94  (boost::program_options::options_description*) output;
95 
96  // Generate the name to be given to boost::program_options.
97  const std::string mappedName =
98  MapParameterName<typename std::remove_pointer<T>::type>(d.name);
99  std::string boostName = (d.alias != '\0') ? mappedName + "," +
100  std::string(1, d.alias) : mappedName;
101 
102  // Note that we have to add the option as type equal to the mapped type, not
103  // the true type of the option.
104  AddToPO<typename ParameterType<typename std::remove_pointer<T>::type>::type>(
105  boostName, d.desc, *desc);
106 }
107 
108 } // namespace cli
109 } // namespace bindings
110 } // namespace mlpack
111 
112 #endif
estimation
f is the set of leaves in the subtree rooted at f $t f For the purposes of density estimation
Definition: det.txt:354
mlpack::data::format
format
Define the formats we can read through boost::serialization.
Definition: format.hpp:20
mlpack::data::Save
bool Save(const std::string &filename, const arma::Mat< eT > &matrix, const bool fatal=false, bool transpose=true)
Saves a matrix to file, guessing the filetype from the extension.
mlpack::ann
Artificial Neural Network.
Definition: hard_sigmoid_function.hpp:19
is_std_vector.hpp
boost
Set the serialization version of the adaboost class.
Definition: adaboost.hpp:180
Thus
f is the set of leaves in the subtree rooted at f $t f For the purposes of density there is a different form of we penalize the sum of the inverse of the volumes of the leaves With this very small volume nodes are discouraged unless the data actually warrants it Thus
Definition: det.txt:358
mlpack::util::ParamData
This structure holds all of the information about a single parameter, including its value (which is s...
Definition: param_data.hpp:52
mlpack
@serialization.hpp
Definition: add_to_po.hpp:21
$V
f f $V(t)\f$ is the volume of the node \f $t\f$ and \f$\tilde
Definition: det.txt:351
mlpack::util::ParamData::desc
std::string desc
Description of this parameter, if any.
Definition: param_data.hpp:58
mlpack::data::xml
@ xml
Definition: format.hpp:24
mlpack::data::Load
bool Load(const std::string &filename, arma::Mat< eT > &matrix, const bool fatal=false, const bool transpose=true)
Loads a matrix from file, guessing the filetype from the extension.
mlpack::util::IsStdVector
Metaprogramming structure for vector detection.
Definition: is_std_vector.hpp:23
mlpack::util::ParamData::name
std::string name
Name of this parameter.
Definition: param_data.hpp:56
regularization
f is the set of leaves in the subtree rooted at f $t f For the purposes of density there is a different form of regularization
Definition: det.txt:355
mlpack::ann::SigmoidLayer
BaseLayer< ActivationFunction, InputDataType, OutputDataType > SigmoidLayer
Standard Sigmoid-Layer using the logistic activation function.
Definition: base_layer.hpp:130
map_parameter_name.hpp
set
set(SOURCES add_to_po.hpp cli_option.hpp default_param.hpp default_param_impl.hpp delete_allocated_memory.hpp end_program.hpp get_allocated_memory.hpp get_param.hpp get_raw_param.hpp get_printable_param.hpp get_printable_param_impl.hpp get_printable_param_name.hpp get_printable_param_name_impl.hpp get_printable_param_value.hpp get_printable_param_value_impl.hpp map_parameter_name.hpp output_param.hpp output_param_impl.hpp parameter_type.hpp parse_command_line.hpp print_doc_functions.hpp print_doc_functions_impl.hpp print_help.hpp print_help.cpp print_type_doc.hpp print_type_doc_impl.hpp set_param.hpp string_type_param.hpp string_type_param_impl.hpp) set(DIR_SRCS) foreach(file $
Definition: CMakeLists.txt:3
mlpack::bindings::cli::AddToPO
void AddToPO(const std::string &boostName, const std::string &descr, boost::program_options::options_description &desc, const typename boost::disable_if< util::IsStdVector< T >>::type *=0, const typename boost::disable_if< std::is_same< T, bool >>::type *=0)
Add a non-vector option to boost::program_options.
Definition: add_to_po.hpp:33
now
this option is not available in DET right now
Definition: det.txt:341
mlpack::util::ParamData::alias
char alias
Alias for this parameter.
Definition: param_data.hpp:63
mlpack::ann::LayerTraits
This is a template class that can provide information about various layers.
Definition: layer_traits.hpp:29
param_data.hpp
alpha
see subsection cli_alt_reg_tut Alternate DET regularization The usual regularized error f $R_ alpha(t)\f$ of a node \f $t\f$ is given by
Definition: det.txt:344