src/mlpack/tests/main_tests/decision_tree_test.cpp
BOOST_AUTO_TEST_CASE(DecisionTreeTrainingVerTest)
{
  arma::mat inputData;
  DatasetInfo info;
  if (!data::Load("vc2.csv", inputData, info))
    BOOST_FAIL("Cannot load train dataset vc2.csv!");

  arma::Row<size_t> labels;
  if (!data::Load("vc2_labels.txt", labels))
    BOOST_FAIL("Cannot load labels for vc2_labels.txt");

  // Initialize an all-ones weight matrix.
  arma::mat weights(1, labels.n_cols, arma::fill::ones);

  // Input training data.
  SetInputParam("training", std::make_tuple(info, inputData));
  SetInputParam("labels", std::move(labels));
  SetInputParam("weights", std::move(weights));

  mlpackMain();

  // Input pre-trained model.
  SetInputParam("input_model",
                std::move(CLI::GetParam<DecisionTreeModel*>("output_model")));

  Log::Fatal.ignoreInput = true;
  BOOST_REQUIRE_THROW(mlpackMain(), std::runtime_error);
  Log::Fatal.ignoreInput = false;
}
/**
 * Make sure only one of training data or pre-trained model is passed.
 */
Make sure only one of training data or pre-trained model is passed.
Make sure only one of training data or pre - trained model is passed .
BOOST_AUTO_TEST_CASE(DecisionTreeTrainingVerTest)
{
  arma::mat inputData;
  DatasetInfo info;
  if (!data::Load("vc2.csv", inputData, info))
    BOOST_FAIL("Cannot load train dataset vc2.csv!");
  arma::Row<size_t> labels;
  if (!data::Load("vc2_labels.txt", labels))
    BOOST_FAIL("Cannot load labels for vc2_labels.txt");
  arma::mat weights(1, labels.n_cols, arma::fill::ones);
  SetInputParam("training", std::make_tuple(info, inputData));
  SetInputParam("labels", std::move(labels));
  SetInputParam("weights", std::move(weights));
  mlpackMain();
  SetInputParam("input_model",
                std::move(CLI::GetParam<DecisionTreeModel*>("output_model")));
  Log::Fatal.ignoreInput = true;
  BOOST_REQUIRE_THROW(mlpackMain(), std::runtime_error);
  Log::Fatal.ignoreInput = false;
}
BOOST_AUTO_TEST_CASE ( DecisionTreeTrainingVerTest ) { arma :: mat inputData ; DatasetInfo info ; if ( ! data :: Load ( " " , inputData , info ) ) BOOST_FAIL ( " " ) ; arma :: Row < size_t > labels ; if ( ! data :: Load ( " " , labels ) ) BOOST_FAIL ( " " ) ; arma :: mat weights ( 1 , labels . n_cols , arma :: fill :: ones ) ; SetInputParam ( " " , std :: make_tuple ( info , inputData ) ) ; SetInputParam ( " " , std :: move ( labels ) ) ; SetInputParam ( " " , std :: move ( weights ) ) ; mlpackMain ( ) ; SetInputParam ( " " , std :: move ( CLI :: GetParam < DecisionTreeModel * > ( " " ) ) ) ; Log :: Fatal . ignoreInput = true ; BOOST_REQUIRE_THROW ( mlpackMain ( ) , std :: runtime_error ) ; Log :: Fatal . ignoreInput = false ; }
Make sure only one of training data or pre-trained model is passed.
Make sure only one of training data or pre - trained model is passed .
// Initialize an all-ones weight matrix. // Input training data. // Input pre-trained model.