diff --git a/HISTORY.md b/HISTORY.md index b5be1c830d..2e77ec990c 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -2,7 +2,8 @@ ###### ????-??-?? * Add Multiple Pole Balancing Environment (#1901). - * Add New paramter Maximum_depth to Decision Tree And Random Forest (#1916). + * Add new parameter `maximum_depth` to decision tree and random forest + bindings (#1916). * Fix prediction output of softmax regression when test set accuracy is calculated (#1922). diff --git a/src/mlpack/methods/decision_tree/decision_tree_impl.hpp b/src/mlpack/methods/decision_tree/decision_tree_impl.hpp index 280a3164e5..8d08a74d8b 100644 --- a/src/mlpack/methods/decision_tree/decision_tree_impl.hpp +++ b/src/mlpack/methods/decision_tree/decision_tree_impl.hpp @@ -657,6 +657,7 @@ double DecisionTree("maximum_depth", [](int x) { return x >= 0; }, true, - "depth must not be negative"); + "maximum depth must not be negative"); RequireParamValue("minimum_gain_split", [](double x) { return (x > 0.0 && x < 1.0); }, true, diff --git a/src/mlpack/methods/random_forest/random_forest_main.cpp b/src/mlpack/methods/random_forest/random_forest_main.cpp index 00cc38af31..6788e3f296 100644 --- a/src/mlpack/methods/random_forest/random_forest_main.cpp +++ b/src/mlpack/methods/random_forest/random_forest_main.cpp @@ -50,7 +50,7 @@ PROGRAM_INFO("Random forests", " controls the number of trees in the random forest. The " + PRINT_PARAM_STRING("minimum_gain_split") + " parameter controls the minimum" " required gain for a decision tree node to split. Larger values will " - "force higher-confidence splits. The " + + "force higher-confidence splits. The " + PRINT_PARAM_STRING("maximum_depth") + " parameter specifies " "the maximum depth of the tree. The " + PRINT_PARAM_STRING("subspace_dim") + " parameter is used to control the " @@ -107,7 +107,7 @@ PARAM_FLAG("print_training_accuracy", "If set, then the accuracy of the model " PARAM_INT_IN("num_trees", "Number of trees in the random forest.", "N", 10); PARAM_INT_IN("minimum_leaf_size", "Minimum number of points in each leaf " "node.", "n", 1); -PARAM_INT_IN("maximum_depth", "Maximum depth of the tree.(0 means no limit)", +PARAM_INT_IN("maximum_depth", "Maximum depth of the tree (0 means no limit).", "D", 0); PARAM_MATRIX_OUT("probabilities", "Predicted class probabilities for each " "point in the test set.", "P"); @@ -181,7 +181,7 @@ static void mlpackMain() RequireParamValue("minimum_leaf_size", [](int x) { return x > 0; }, true, "minimum leaf size must be greater than 0"); RequireParamValue("maximum_depth", [](int x) { return x >= 0; }, true, - "depth must not be negative"); + "maximum depth must not be negative"); RequireParamValue("subspace_dim", [](int x) { return x >= 0; }, true, "subspace dimensionality must be nonnegative"); RequireParamValue("minimum_gain_split", diff --git a/src/mlpack/tests/decision_tree_test.cpp b/src/mlpack/tests/decision_tree_test.cpp index c44f7a7bca..334fa745a9 100644 --- a/src/mlpack/tests/decision_tree_test.cpp +++ b/src/mlpack/tests/decision_tree_test.cpp @@ -1217,7 +1217,7 @@ BOOST_AUTO_TEST_CASE(DecisionTreeCategoricalTrainReturnEntropy) } /** - * Make sure different Maximum Depth gives different number of children. + * Make sure different maximum depth values give different numbers of children. */ BOOST_AUTO_TEST_CASE(DifferentMaximumDepthTest) { diff --git a/src/mlpack/tests/main_tests/decision_tree_test.cpp b/src/mlpack/tests/main_tests/decision_tree_test.cpp index 159f8cd753..b770d333fd 100644 --- a/src/mlpack/tests/main_tests/decision_tree_test.cpp +++ b/src/mlpack/tests/main_tests/decision_tree_test.cpp @@ -174,7 +174,7 @@ BOOST_AUTO_TEST_CASE(DecisionTreeMinimumLeafSizeTest) } /** - * Make sure maximum depth size is always a non-negative number. + * Make sure maximum depth is always a non-negative number. */ BOOST_AUTO_TEST_CASE(DecisionTreeNonNegativeMaximumDepthTest) { @@ -201,6 +201,7 @@ BOOST_AUTO_TEST_CASE(DecisionTreeNonNegativeMaximumDepthTest) BOOST_REQUIRE_THROW(mlpackMain(), std::runtime_error); Log::Fatal.ignoreInput = false; } + /** * Make sure minimum gain split is always a fraction in range [0,1]. */ @@ -454,8 +455,7 @@ BOOST_AUTO_TEST_CASE(DecisionModelCategoricalReuseTest) } /** - * Check that different maximum depth gives - * different results. + * Check that different maximum depths give different results. */ BOOST_AUTO_TEST_CASE(DecisionTreeMaximumDepthTest) {