33 void train_on_dataset(
const std::string & dataset,
bool train_svm) {
36 std::cout <<
"\n=== " << dataset <<
" ===\n";
37 std::cout <<
"\tInitializing the environment ...\n";
39 util::setup_environment(dataset,
true, env);
42 env.
set_method(
ged::Options::GEDMethod::RING_ML, util::init_options(dataset,
"ring_ml_dnn",
"ring_ml",
true,
false, 16) + util::ground_truth_option(dataset) +
" --ml-method DNN --save-ground-truth " + util::config_prefix(dataset) +
"ground_truth.data");
44 env.
set_method(
ged::Options::GEDMethod::BIPARTITE_ML, util::init_options(dataset,
"bipartite_ml_BIPARTITE_dnn",
"bipartite_ml_BIPARTITE",
true,
false, 16) +
" --ml-method DNN --load-ground-truth " + util::config_prefix(dataset) +
"ground_truth.data");
48 env.
set_method(
ged::Options::GEDMethod::RING_ML, util::init_options(dataset,
"ring_ml_one_class_svm",
"ring_ml_one_class",
true,
false, 16) + util::ground_truth_option(dataset) +
" --ml-method ONE_CLASS_SVM --load-ground-truth " + util::config_prefix(dataset) +
"ground_truth.data");
50 env.
set_method(
ged::Options::GEDMethod::BIPARTITE_ML, util::init_options(dataset,
"bipartite_ml_BIPARTITE_one_class_svm",
"bipartite_ml_BIPARTITE_one_class",
true,
false, 16) +
" --ml-method ONE_CLASS_SVM --load-ground-truth " + util::config_prefix(dataset) +
"ground_truth.data");
55 env.
set_method(
ged::Options::GEDMethod::RING_ML, util::init_options(dataset,
"ring_ml_svm",
"ring_ml",
false,
true, 16) + util::ground_truth_option(dataset) +
" --ml-method SVM --load-ground-truth " + util::config_prefix(dataset) +
"ground_truth.data");
57 env.
set_method(
ged::Options::GEDMethod::BIPARTITE_ML, util::init_options(dataset,
"bipartite_ml_BIPARTITE_svm",
"bipartite_ml_BIPARTITE",
false,
true, 16) +
" --ml-method SVM --load-ground-truth " + util::config_prefix(dataset) +
"ground_truth.data");
62 int main(
int argc,
char* argv[]) {
63 std::vector<std::string> datasets;
67 std::string first_option(argv[i]);
68 if (first_option ==
"--no-svm") {
73 std::cout <<
"first option = \"" << first_option <<
"\"\n";
76 for (; i < argc; i++) {
77 datasets.push_back(std::string(argv[i]));
78 util::check_dataset(datasets.back());
80 if (datasets.empty()) {
81 util::setup_datasets(datasets);
83 for (
auto dataset : datasets) {
85 train_on_dataset(dataset, train_svm);
87 catch (
const std::exception & error) {
88 std::cerr << error.what() <<
". " <<
"Error on " << dataset <<
".\n";
void init_method()
Initializes the method specified by call to set_method().
Provides utility functions for tests of PR submission.
Selects ged::BipartiteML.
void set_method(Options::GEDMethod method, const std::string &options=std::string(""))
Sets the GEDMethod to be used by run_method().
Provides the API of GEDLIB.