src/mlpack/tests/main_tests/adaboost_test.cpp
BOOST_AUTO_TEST_CASE(AdaBoostModelReuseTest)
{
  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", std::move(trainData));
  SetInputParam("labels", std::move(labels));

  SetInputParam("test", testData);

  mlpackMain();

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

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

  SetInputParam("test", std::move(testData));
  SetInputParam("input_model",
                CLI::GetParam<AdaBoostModel*>("output_model"));

  mlpackMain();

  // Check that initial output and output using saved model are same.
  CheckMatrices(output, CLI::GetParam<arma::Row<size_t>>("output"));
}
/**
 * Ensure that saved model can be used again.
 */
Ensure that saved model can be used again.
Ensure that saved model can be used again .
BOOST_AUTO_TEST_CASE(AdaBoostModelReuseTest)
{
  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", std::move(trainData));
  SetInputParam("labels", std::move(labels));
  SetInputParam("test", testData);
  mlpackMain();
  arma::Row<size_t> output;
  output = std::move(CLI::GetParam<arma::Row<size_t>>("output"));
  CLI::GetSingleton().Parameters()["training"].wasPassed = false;
  CLI::GetSingleton().Parameters()["labels"].wasPassed = false;
  CLI::GetSingleton().Parameters()["test"].wasPassed = false;
  SetInputParam("test", std::move(testData));
  SetInputParam("input_model",
                CLI::GetParam<AdaBoostModel*>("output_model"));
  mlpackMain();
  CheckMatrices(output, CLI::GetParam<arma::Row<size_t>>("output"));
}
BOOST_AUTO_TEST_CASE ( AdaBoostModelReuseTest ) { 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 ( " " , std :: move ( trainData ) ) ; SetInputParam ( " " , std :: move ( labels ) ) ; SetInputParam ( " " , testData ) ; mlpackMain ( ) ; arma :: Row < size_t > output ; output = std :: move ( CLI :: GetParam < arma :: Row < size_t > > ( " " ) ) ; CLI :: GetSingleton ( ) . Parameters ( ) [ " " ] . wasPassed = false ; CLI :: GetSingleton ( ) . Parameters ( ) [ " " ] . wasPassed = false ; CLI :: GetSingleton ( ) . Parameters ( ) [ " " ] . wasPassed = false ; SetInputParam ( " " , std :: move ( testData ) ) ; SetInputParam ( " " , CLI :: GetParam < AdaBoostModel * > ( " " ) ) ; mlpackMain ( ) ; CheckMatrices ( output , CLI :: GetParam < arma :: Row < size_t > > ( " " ) ) ; }
Ensure that saved model can be used again.
Ensure that saved model can be used again .
// Check that initial output and output using saved model are same.