Update attribute.py #5
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.
I added this code just in case that there is a new value of nominal attribute coming up to update_classfier(). Apart from the stage of building classifier, while new instances with new value of nominal attribute are streaming into the classifier, this new value is neither known nor indexed in the set of attribute's value yet.
As far as I have experimented on my model before adding this contribution, it is necessary to probe all possible values of nominal attributes once and for all in build_classifier(), which I think that this might not possible for some kind of applications where new values are continuously appeared, say network traffic.
I am not sure if this adding would defy the semantic of Hoeffding Tree or not. But without this, ValueError shall be raised and hence unavoidably inhabit the training progress since 'class Attribute' is not able to index unknown attribute's value.
PS, anyway, thank you so much for explaining me in our recent mail discussion.