9#include <mva/interface/Interface.h>
10#include <mva/interface/Options.h>
11#include <mva/utility/Utility.h>
17namespace po = boost::program_options;
18using namespace Belle2::MVA;
20int main(
int argc,
char* argv[])
26 po::options_description general_description(general_options.getDescription());
29 po::options_description meta_description(meta_options.getDescription());
36 std::map<std::string, std::unique_ptr<SpecificOptions>> specific_options;
39 specific_options.emplace(interface.second->getName(), interface.second->getOptions());
45 po::options_description cmdline_description;
46 cmdline_description.add(general_description);
47 cmdline_description.add(meta_description);
49 po::parsed_options parsed = po::command_line_parser(argc, argv).options(cmdline_description).allow_unregistered().run();
50 po::store(parsed, vm);
52 if (vm.count(
"help")) {
53 if (vm.count(
"method")) {
54 std::string method = vm[
"method"].as<std::string>();
55 if (specific_options.find(method) != specific_options.end()) {
56 std::cout << specific_options[method]->getDescription() << std::endl;
58 std::cerr <<
"Provided method is unknown" << std::endl;
61 std::cout << general_description << std::endl;
62 std::cout << meta_description << std::endl;
68 if (vm.count(
"method")) {
69 std::string method = vm[
"method"].as<std::string>();
70 if (specific_options.find(method) != specific_options.end()) {
71 cmdline_description.add(specific_options[method]->getDescription());
72 po::parsed_options specific_parsed = po::command_line_parser(argc, argv).options(cmdline_description).run();
73 po::store(specific_parsed, vm);
76 std::cerr <<
"Provided method is unknown" << std::endl;
80 std::cerr <<
"You must provide a method" << std::endl;
83 }
catch (po::error& err) {
84 std::cerr <<
"Error: " << err.what() <<
"\n";
89 if (specific_options.find(general_options.m_method) == specific_options.end()) {
90 std::cerr <<
"Unknown method " << general_options.m_method << std::endl;
static void initSupportedInterfaces()
Static function which initliazes all supported interfaces, has to be called once before getSupportedI...
static std::map< std::string, AbstractInterface * > getSupportedInterfaces()
Returns interfaces supported by the MVA Interface.
General options which are shared by all MVA trainings.
static void teacher(const GeneralOptions &general_options, const SpecificOptions &specific_options, const MetaOptions &meta_options=MetaOptions())
Convenience function which performs a training with the given options.