Skip to content

SAMOA-73: fixes NullPointerException in VerticalHoeffdingTree #73

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ final class FoundNode implements java.io.Serializable {
*/
private static final long serialVersionUID = -637695387934143293L;

private final Node node;
private Node node;
private final SplitNode parent;
private final int parentBranch;

Expand All @@ -54,6 +54,17 @@ Node getNode() {
return this.node;
}

/**
* Method to set the node where an instance is routed/filtered through the decision tree model for testing and
* training. The method is expected to be used when the original FoundNode object had null node property.
* This is to add a reference to a newly established node object.
*
* @param node the node reference to be inserted
*/
void setNode(Node node) {
this.node = node;
}

/**
* Method to get the parent of the node where an instance is routed/filtered through the decision tree model for
* testing and training
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ private void trainOnInstanceImpl(FoundNode foundNode, Instance inst) {

if (leafNode == null) {
leafNode = newLearningNode(this.parallelismHint);
foundNode.setNode(leafNode);
foundNode.getParent().setChild(foundNode.getParentBranch(), leafNode);
activeLeafNodeCount++;
}
Expand Down