src/mlpack/tests/main_tests/adaboost_test.cpp
BOOST_AUTO_TEST_CASE(AdaBoostDiffWeakLearnerOutputTest)
{
  arma::mat trainData;
  if (!data::Load("vc2.csv", trainData))
    BOOST_FAIL("Unable to load train dataset vc2.csv!");

  arma::Row<size_t> labels;
  if (!data::Load("vc2_labels.txt", labels))
    BOOST_FAIL("Unable to load label dataset vc2_labels.txt!");

  arma::mat testData;
  if (!data::Load("vc2_test.csv", testData))
    BOOST_FAIL("Unable to load test dataset vc2.csv!");

  SetInputParam("training", trainData);
  SetInputParam("labels", labels);
  SetInputParam("test", testData);

  mlpackMain();

  arma::Row<size_t> output;
  output = std::move(CLI::GetParam<arma::Row<size_t>>("output"));

  bindings::tests::CleanMemory();

  CLI::GetSingleton().Parameters()["training"].wasPassed = false;
  CLI::GetSingleton().Parameters()["labels"].wasPassed = false;
  CLI::GetSingleton().Parameters()["test"].wasPassed = false;

  SetInputParam("training", trainData);
  SetInputParam("labels", labels);
  SetInputParam("test", testData);
  SetInputParam("weak_learner", std::string("perceptron"));

  mlpackMain();

  arma::Row<size_t> outputPerceptron;
  outputPerceptron = std::move(CLI::GetParam<arma::Row<size_t>>("output"));

  BOOST_REQUIRE_GT(arma::accu(output != outputPerceptron), 1);
}
/**
 * Different Weak learner should give different outputs.
 */
Different Weak learner should give different outputs.
Different Weak learner should give different outputs .
BOOST_AUTO_TEST_CASE(AdaBoostDiffWeakLearnerOutputTest)
{
  arma::mat trainData;
  if (!data::Load("vc2.csv", trainData))
    BOOST_FAIL("Unable to load train dataset vc2.csv!");
  arma::Row<size_t> labels;
  if (!data::Load("vc2_labels.txt", labels))
    BOOST_FAIL("Unable to load label dataset vc2_labels.txt!");
  arma::mat testData;
  if (!data::Load("vc2_test.csv", testData))
    BOOST_FAIL("Unable to load test dataset vc2.csv!");
  SetInputParam("training", trainData);
  SetInputParam("labels", labels);
  SetInputParam("test", testData);
  mlpackMain();
  arma::Row<size_t> output;
  output = std::move(CLI::GetParam<arma::Row<size_t>>("output"));
  bindings::tests::CleanMemory();
  CLI::GetSingleton().Parameters()["training"].wasPassed = false;
  CLI::GetSingleton().Parameters()["labels"].wasPassed = false;
  CLI::GetSingleton().Parameters()["test"].wasPassed = false;
  SetInputParam("training", trainData);
  SetInputParam("labels", labels);
  SetInputParam("test", testData);
  SetInputParam("weak_learner", std::string("perceptron"));
  mlpackMain();
  arma::Row<size_t> outputPerceptron;
  outputPerceptron = std::move(CLI::GetParam<arma::Row<size_t>>("output"));
  BOOST_REQUIRE_GT(arma::accu(output != outputPerceptron), 1);
}
BOOST_AUTO_TEST_CASE ( AdaBoostDiffWeakLearnerOutputTest ) { arma :: mat trainData ; if ( ! data :: Load ( " " , trainData ) ) BOOST_FAIL ( " " ) ; arma :: Row < size_t > labels ; if ( ! data :: Load ( " " , labels ) ) BOOST_FAIL ( " " ) ; arma :: mat testData ; if ( ! data :: Load ( " " , testData ) ) BOOST_FAIL ( " " ) ; SetInputParam ( " " , trainData ) ; SetInputParam ( " " , labels ) ; SetInputParam ( " " , testData ) ; mlpackMain ( ) ; arma :: Row < size_t > output ; output = std :: move ( CLI :: GetParam < arma :: Row < size_t > > ( " " ) ) ; bindings :: tests :: CleanMemory ( ) ; CLI :: GetSingleton ( ) . Parameters ( ) [ " " ] . wasPassed = false ; CLI :: GetSingleton ( ) . Parameters ( ) [ " " ] . wasPassed = false ; CLI :: GetSingleton ( ) . Parameters ( ) [ " " ] . wasPassed = false ; SetInputParam ( " " , trainData ) ; SetInputParam ( " " , labels ) ; SetInputParam ( " " , testData ) ; SetInputParam ( " " , std :: string ( " " ) ) ; mlpackMain ( ) ; arma :: Row < size_t > outputPerceptron ; outputPerceptron = std :: move ( CLI :: GetParam < arma :: Row < size_t > > ( " " ) ) ; BOOST_REQUIRE_GT ( arma :: accu ( output != outputPerceptron ) , 1 ) ; }
Different Weak learner should give different outputs.
Different Weak learner should give different outputs .