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

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

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

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

  SetInputParam("minimum_gain_split", 1.5); // Invalid.

  Log::Fatal.ignoreInput = true;
  BOOST_REQUIRE_THROW(mlpackMain(), std::runtime_error);
  Log::Fatal.ignoreInput = false;
}
/**
 * Make sure minimum gain split is always a fraction in range [0,1].
 */
Make sure minimum gain split is always a fraction in range [0,1].
Make sure minimum gain split is always a fraction in range [ 0 1 ] .
BOOST_AUTO_TEST_CASE(DecisionMinimumGainSplitTest)
{
  arma::mat inputData;
  DatasetInfo info;
  if (!data::Load("braziltourism.arff", inputData, info))
    BOOST_FAIL("Cannot load train dataset braziltourism.arff!");
  arma::Row<size_t> labels;
  if (!data::Load("braziltourism_labels.txt", labels))
    BOOST_FAIL("Cannot load labels for braziltourism_labels.txt");
  arma::mat weights(1, labels.n_cols, arma::fill::ones);
  SetInputParam("training", std::move(std::make_tuple(info, inputData)));
  SetInputParam("labels", std::move(labels));
  SetInputParam("weights", std::move(weights));
  SetInputParam("minimum_gain_split", 1.5); 
  Log::Fatal.ignoreInput = true;
  BOOST_REQUIRE_THROW(mlpackMain(), std::runtime_error);
  Log::Fatal.ignoreInput = false;
}
BOOST_AUTO_TEST_CASE ( DecisionMinimumGainSplitTest ) { 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 :: move ( std :: make_tuple ( info , inputData ) ) ) ; SetInputParam ( " " , std :: move ( labels ) ) ; SetInputParam ( " " , std :: move ( weights ) ) ; SetInputParam ( " " , 1.5 ) ; Log :: Fatal . ignoreInput = true ; BOOST_REQUIRE_THROW ( mlpackMain ( ) , std :: runtime_error ) ; Log :: Fatal . ignoreInput = false ; }
Make sure minimum gain split is always a fraction in range [0,1].
Make sure minimum gain split is always a fraction in range [ 0 1 ] .
// Initialize an all-ones weight matrix. // Input training data. // Invalid.