34 unsigned int ell = 30;
35 unsigned int tests = 100;
54 std::tuple<std::string,McSvm,bool> machines[18] ={
55 std::make_tuple(
"OVA", McSvm::OVA,
false),
56 std::make_tuple(
"CS", McSvm::CS,
false),
57 std::make_tuple(
"WW",McSvm::WW,
false),
58 std::make_tuple(
"LLW",McSvm::LLW,
false),
59 std::make_tuple(
"ADM",McSvm::ADM,
false),
60 std::make_tuple(
"ATS",McSvm::ATS,
false),
61 std::make_tuple(
"ATM",McSvm::ATM,
false),
62 std::make_tuple(
"MMR",McSvm::MMR,
false),
63 std::make_tuple(
"ReinforcedSvm",McSvm::ReinforcedSvm,
false),
64 std::make_tuple(
"OVA", McSvm::OVA,
true),
65 std::make_tuple(
"CS", McSvm::CS,
true),
66 std::make_tuple(
"WW",McSvm::WW,
true),
67 std::make_tuple(
"LLW",McSvm::LLW,
true),
68 std::make_tuple(
"ADM",McSvm::ADM,
true),
69 std::make_tuple(
"ATS",McSvm::ATS,
true),
70 std::make_tuple(
"ATM",McSvm::ATM,
true),
71 std::make_tuple(
"MMR",McSvm::MMR,
true),
72 std::make_tuple(
"ReinforcedSvm",McSvm::ReinforcedSvm,
true)
75 std::printf(
"SHARK multi-class SVM example - training 18 machines:\n");
76 for (
int i=0; i<18; i++)
80 trainer.
train(svm, training);
82 double train_error = loss.
eval(training.
labels(), output);
83 output = svm(test.
inputs());
84 double test_error = loss.
eval(test.
labels(), output);
86 std::cout<<std::get<0>(machines[i])<<(trainer.
trainOffset()?
" w bias ":
" w/o bias");
87 std::cout<<
"\ttraining error="<<train_error;
88 std::cout<<
"\ttest error="<<test_error;