Repository: incubator-samoa Updated Branches: refs/heads/master 1bd1012af -> 30a4ed185
SAMOA-52: Fix nominal attributes problem in VHT Project: http://git-wip-us.apache.org/repos/asf/incubator-samoa/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-samoa/commit/30a4ed18 Tree: http://git-wip-us.apache.org/repos/asf/incubator-samoa/tree/30a4ed18 Diff: http://git-wip-us.apache.org/repos/asf/incubator-samoa/diff/30a4ed18 Branch: refs/heads/master Commit: 30a4ed1856ddc00f2fc50aa88660b4057b06bb60 Parents: 1bd1012 Author: Albert Bifet <[email protected]> Authored: Mon Dec 7 14:20:00 2015 +0100 Committer: Albert Bifet <[email protected]> Committed: Tue Mar 15 18:30:16 2016 +0100 ---------------------------------------------------------------------- .../classifiers/trees/ActiveLearningNode.java | 2 ++ .../trees/ModelAggregatorProcessor.java | 34 +++++++++++--------- 2 files changed, 20 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-samoa/blob/30a4ed18/samoa-api/src/main/java/org/apache/samoa/learners/classifiers/trees/ActiveLearningNode.java ---------------------------------------------------------------------- diff --git a/samoa-api/src/main/java/org/apache/samoa/learners/classifiers/trees/ActiveLearningNode.java b/samoa-api/src/main/java/org/apache/samoa/learners/classifiers/trees/ActiveLearningNode.java index 860b951..a437719 100644 --- a/samoa-api/src/main/java/org/apache/samoa/learners/classifiers/trees/ActiveLearningNode.java +++ b/samoa-api/src/main/java/org/apache/samoa/learners/classifiers/trees/ActiveLearningNode.java @@ -178,6 +178,8 @@ final class ActiveLearningNode extends LearningNode { this.isSplitting = false; logger.trace("wasted instance: {}", this.thrownAwayInstance); this.thrownAwayInstance = 0; + this.bestSuggestion = null; + this.secondBestSuggestion = null; } AttributeSplitSuggestion getDistributedBestSuggestion() { http://git-wip-us.apache.org/repos/asf/incubator-samoa/blob/30a4ed18/samoa-api/src/main/java/org/apache/samoa/learners/classifiers/trees/ModelAggregatorProcessor.java ---------------------------------------------------------------------- diff --git a/samoa-api/src/main/java/org/apache/samoa/learners/classifiers/trees/ModelAggregatorProcessor.java b/samoa-api/src/main/java/org/apache/samoa/learners/classifiers/trees/ModelAggregatorProcessor.java index cad40a7..aff25bf 100644 --- a/samoa-api/src/main/java/org/apache/samoa/learners/classifiers/trees/ModelAggregatorProcessor.java +++ b/samoa-api/src/main/java/org/apache/samoa/learners/classifiers/trees/ModelAggregatorProcessor.java @@ -439,22 +439,24 @@ final class ModelAggregatorProcessor implements Processor { * The data structure to represents the filtering of the instance using the tree model. */ private void attemptToSplit(ActiveLearningNode activeLearningNode, FoundNode foundNode) { - // Increment the split ID - this.splitId++; - - // Schedule time-out thread - ScheduledFuture<?> timeOutHandler = this.executor.schedule(new AggregationTimeOutHandler(this.splitId, - this.timedOutSplittingNodes), this.timeOut, TimeUnit.SECONDS); - - // Keep track of the splitting node information, so that we can continue the - // split - // once we receive all local statistic calculation from Local Statistic PI - // this.splittingNodes.put(Long.valueOf(this.splitId), new - // SplittingNodeInfo(activeLearningNode, foundNode, null)); - this.splittingNodes.put(this.splitId, new SplittingNodeInfo(activeLearningNode, foundNode, timeOutHandler)); - - // Inform Local Statistic PI to perform local statistic calculation - activeLearningNode.requestDistributedSuggestions(this.splitId, this); + if (!activeLearningNode.observedClassDistributionIsPure()) { + // Increment the split ID + this.splitId++; + + // Schedule time-out thread + ScheduledFuture<?> timeOutHandler = this.executor.schedule(new AggregationTimeOutHandler(this.splitId, + this.timedOutSplittingNodes), this.timeOut, TimeUnit.SECONDS); + + // Keep track of the splitting node information, so that we can continue the + // split + // once we receive all local statistic calculation from Local Statistic PI + // this.splittingNodes.put(Long.valueOf(this.splitId), new + // SplittingNodeInfo(activeLearningNode, foundNode, null)); + this.splittingNodes.put(this.splitId, new SplittingNodeInfo(activeLearningNode, foundNode, timeOutHandler)); + + // Inform Local Statistic PI to perform local statistic calculation + activeLearningNode.requestDistributedSuggestions(this.splitId, this); + } } /**
