Better handling of empty Hoeffding trees #2964
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In #2962, @xlindo pointed out some issues when trying to train a Hoeffding tree after it was created with an empty constructor. I went through the code and realized that there are some situations where this does not work correctly; therefore, I went through and refactored things such that the code in #2962 now works. In essence, the problem was that a
HoeffdingTree<>
stores adata::DatasetInfo
and a few other parameters that track how many dimensions are in the data and what type those are, but the code does not provide clear facilities for how to modify those quantities.Specifically, I made the following changes:
Train()
to be clear about when the tree will and won't be reset.resetTree
to the overload ofTrain()
that doesn't take adatasetInfo
. This makes it possible to reset the internal state of a tree even without passing aDatasetInfo
.TrainInternal()
andResetTree()
, which are meant to be called internally.