Make sure a model is saved before the next example loads one.

This commit is contained in:
Ryan Curtin
2024-07-01 15:32:36 -04:00
parent 9f320eaeda
commit ef52b3fad6
2 changed files with 6 additions and 2 deletions
+5 -1
View File
@@ -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);
```
---
@@ -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;