From e13375962f9f8f423ebeed13c7be21abee64785c Mon Sep 17 00:00:00 2001 From: EdwardRaff Date: Mon, 30 May 2016 21:40:58 -0400 Subject: [PATCH] bug fix for NaN giving silly values --- JSAT/src/jsat/classifiers/trees/DecisionStump.java | 2 +- JSAT/test/jsat/classifiers/trees/RandomForestTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/JSAT/src/jsat/classifiers/trees/DecisionStump.java b/JSAT/src/jsat/classifiers/trees/DecisionStump.java index c125a935..517d18d6 100644 --- a/JSAT/src/jsat/classifiers/trees/DecisionStump.java +++ b/JSAT/src/jsat/classifiers/trees/DecisionStump.java @@ -911,7 +911,7 @@ else if(i > DPs.size()-minResultSplitSize-nans) thisSplitSqrdErr = Double.NEGATIVE_INFINITY; } //Now compare what weve done - if(thisSplitSqrdErr < lowestSplitSqrdError.get()) + if(thisSplitSqrdErr >= 0 && thisSplitSqrdErr < lowestSplitSqrdError.get())//how did we get -Inf? { synchronized(bestSplit) { diff --git a/JSAT/test/jsat/classifiers/trees/RandomForestTest.java b/JSAT/test/jsat/classifiers/trees/RandomForestTest.java index 43c2e88a..6bac8036 100644 --- a/JSAT/test/jsat/classifiers/trees/RandomForestTest.java +++ b/JSAT/test/jsat/classifiers/trees/RandomForestTest.java @@ -218,7 +218,7 @@ public void testClone() RandomForest instance = new RandomForest(); ClassificationDataSet t1 = FixedProblems.getSimpleKClassLinear(100, 3); - ClassificationDataSet t2 = FixedProblems.getSimpleKClassLinear(100, 6); + ClassificationDataSet t2 = FixedProblems.getSimpleKClassLinear(100, 4); if(useCatFeatures) { t1.applyTransform(new NumericalToHistogram(t1));