diff --git a/doc/user/methods/decision_tree_regressor.md b/doc/user/methods/decision_tree_regressor.md index e07f3c01e1..f484b30ce1 100644 --- a/doc/user/methods/decision_tree_regressor.md +++ b/doc/user/methods/decision_tree_regressor.md @@ -194,7 +194,8 @@ See also the [simple usage example](#simple-usage-example) for a trivial use of --- -Train a decision tree regressor on mixed categorical data. +Train a decision tree regressor on mixed categorical data and save the model to +disk. ```c++ // Load a categorical dataset. @@ -235,6 +236,9 @@ tree.Predict(testData, testPredictions); const double testAverageError = arma::mean(testResponses - testPredictions); std::cout << "Average error on test set: " << testAverageError << "." << std::endl; + +// Save the tree to "tree.bin" with the name "tree". +mlpack::data::Save("tree.bin", "tree", tree); ``` --- diff --git a/src/mlpack/methods/decision_tree/decision_tree_regressor.hpp b/src/mlpack/methods/decision_tree/decision_tree_regressor.hpp index 3fb57cd314..67f50695a8 100644 --- a/src/mlpack/methods/decision_tree/decision_tree_regressor.hpp +++ b/src/mlpack/methods/decision_tree/decision_tree_regressor.hpp @@ -450,7 +450,7 @@ class DecisionTreeRegressor : //! The dimension of the split, for internal nodes. size_t splitDimension; }; - //! For internal nodes, the type of the split variable. + //! For internal nodes, the type of the split variable. size_t dimensionType; //! For internal nodes, the split information for the splitter. arma::vec splitInfo;