diff --git a/adaa.analytics.rules/build.gradle b/adaa.analytics.rules/build.gradle index bc104317..52fb3567 100644 --- a/adaa.analytics.rules/build.gradle +++ b/adaa.analytics.rules/build.gradle @@ -27,7 +27,7 @@ codeQuality { } sourceCompatibility = 1.8 -version = '1.7.10' +version = '1.7.11' jar { diff --git a/adaa.analytics.rules/src/main/java/adaa/analytics/rules/logic/induction/AbstractFinder.java b/adaa.analytics.rules/src/main/java/adaa/analytics/rules/logic/induction/AbstractFinder.java index 586a9fdd..f169c1ad 100644 --- a/adaa.analytics.rules/src/main/java/adaa/analytics/rules/logic/induction/AbstractFinder.java +++ b/adaa.analytics.rules/src/main/java/adaa/analytics/rules/logic/induction/AbstractFinder.java @@ -358,10 +358,7 @@ protected Set names2attributes(Set names, ExampleSet dataset) return fractionCurrentGeneration * sizeToCover; }else { - return Math.min( - params.getAbsoluteMinimumCovered(size), - Math.max(1.0, 0.2 * size)); - + return params.getAbsoluteMinimumCovered(size); } } diff --git a/adaa.analytics.rules/src/main/java/adaa/analytics/rules/logic/induction/ActionFinder.java b/adaa.analytics.rules/src/main/java/adaa/analytics/rules/logic/induction/ActionFinder.java index 45418c94..2f8936ba 100644 --- a/adaa.analytics.rules/src/main/java/adaa/analytics/rules/logic/induction/ActionFinder.java +++ b/adaa.analytics.rules/src/main/java/adaa/analytics/rules/logic/induction/ActionFinder.java @@ -232,9 +232,7 @@ public boolean tryAddCondition( } // analyse stopping criteria - double adjustedMinCov = Math.min( - params.getMinimumCovered(), - Math.max(1.0, 0.2 * ct.weighted_P)); + double adjustedMinCov = params.getMinimumCovered(); if (ct.weighted_p < adjustedMinCov) { if (rule.getPremise().getSubconditions().size() == 0) { diff --git a/adaa.analytics.rules/src/main/java/adaa/analytics/rules/logic/induction/ApproximateClassificationSnC.java b/adaa.analytics.rules/src/main/java/adaa/analytics/rules/logic/induction/ApproximateClassificationSnC.java index 0a914862..a55212cf 100644 --- a/adaa.analytics.rules/src/main/java/adaa/analytics/rules/logic/induction/ApproximateClassificationSnC.java +++ b/adaa.analytics.rules/src/main/java/adaa/analytics/rules/logic/induction/ApproximateClassificationSnC.java @@ -19,7 +19,6 @@ public class ApproximateClassificationSnC extends ClassificationSnC { public ApproximateClassificationSnC(AbstractFinder finder, InductionParameters params) { super(finder, params); - numClassThreads = 1; // fix number of class threads } @Override diff --git a/adaa.analytics.rules/src/main/java/adaa/analytics/rules/logic/induction/ClassificationExpertFinder.java b/adaa.analytics.rules/src/main/java/adaa/analytics/rules/logic/induction/ClassificationExpertFinder.java index bc03410b..5647b957 100644 --- a/adaa.analytics.rules/src/main/java/adaa/analytics/rules/logic/induction/ClassificationExpertFinder.java +++ b/adaa.analytics.rules/src/main/java/adaa/analytics/rules/logic/induction/ClassificationExpertFinder.java @@ -361,16 +361,10 @@ public int grow( */ @Override protected boolean checkCandidate(ElementaryCondition cnd, double classId, double p, double n, double new_p, double P,double uncoveredSize, int ruleOrderNum) { - double adjustedMinCov = - Math.min( - params.getAbsoluteMinimumCovered(P), - Math.max(1.0, 0.2 * P)); - if (new_p >= adjustedMinCov && p >= params.getAbsoluteMinimumCoveredAll(P)) { - return true && - !knowledge.isForbidden(cnd.getAttribute(), cnd.getValueSet(), (int)classId); - } else { - return false; - } + + return new_p >= params.getAbsoluteMinimumCovered(P) + && p >= params.getAbsoluteMinimumCoveredAll(P) + && !knowledge.isForbidden(cnd.getAttribute(), cnd.getValueSet(), (int)classId); } diff --git a/adaa.analytics.rules/src/main/java/adaa/analytics/rules/logic/induction/ClassificationFinder.java b/adaa.analytics.rules/src/main/java/adaa/analytics/rules/logic/induction/ClassificationFinder.java index 82b06dc1..044b15db 100644 --- a/adaa.analytics.rules/src/main/java/adaa/analytics/rules/logic/induction/ClassificationFinder.java +++ b/adaa.analytics.rules/src/main/java/adaa/analytics/rules/logic/induction/ClassificationFinder.java @@ -906,13 +906,9 @@ public boolean tryAddCondition( * @return */ protected boolean checkCandidate(ElementaryCondition cnd, double classId, double p, double n, double new_p, double P,double uncoveredSize, int ruleOrderNum) { - double adjustedMinCov = - countAbsoluteMinimumCovered(P, ruleOrderNum, uncoveredSize); - if (new_p >= adjustedMinCov && p >= params.getAbsoluteMinimumCoveredAll(P)) { - return true; - } else { - return false; - } + + return new_p >= countAbsoluteMinimumCovered(P, ruleOrderNum, uncoveredSize) + && p >= params.getAbsoluteMinimumCoveredAll(P); } diff --git a/adaa.analytics.rules/src/main/java/adaa/analytics/rules/logic/induction/ClassificationSnC.java b/adaa.analytics.rules/src/main/java/adaa/analytics/rules/logic/induction/ClassificationSnC.java index 08690108..3297e738 100644 --- a/adaa.analytics.rules/src/main/java/adaa/analytics/rules/logic/induction/ClassificationSnC.java +++ b/adaa.analytics.rules/src/main/java/adaa/analytics/rules/logic/induction/ClassificationSnC.java @@ -45,8 +45,6 @@ public class ClassificationSnC extends AbstractSeparateAndConquer { */ protected AbstractFinder finder; - protected int numClassThreads = 1; - public ClassificationSnC(AbstractFinder finder, InductionParameters params) { super(params); this.finder = finder; diff --git a/adaa.analytics.rules/src/main/java/adaa/analytics/rules/logic/induction/InductionParameters.java b/adaa.analytics.rules/src/main/java/adaa/analytics/rules/logic/induction/InductionParameters.java index c09c93e1..68ba46b9 100644 --- a/adaa.analytics.rules/src/main/java/adaa/analytics/rules/logic/induction/InductionParameters.java +++ b/adaa.analytics.rules/src/main/java/adaa/analytics/rules/logic/induction/InductionParameters.java @@ -77,7 +77,7 @@ public class InductionParameters implements Serializable { public double getMinimumCovered() {return minimumCovered;} public double getAbsoluteMinimumCovered(double size) { - return minimumCovered * (minimumCovered >= 1 ? 1 : size); + return Math.max(1, minimumCovered * (minimumCovered >= 1 ? 1 : size)); } public void setMinimumCovered(double minimumCovered) {this.minimumCovered = minimumCovered;} diff --git a/adaa.analytics.rules/test/resources/reports/ClassificationExpertSnCTest/test_seismic-bumps.guided-c2, gimpuls_750 extended.seismic-bumps-train-minimal.txt b/adaa.analytics.rules/test/resources/reports/ClassificationExpertSnCTest/test_seismic-bumps.guided-c2, gimpuls_750 extended.seismic-bumps-train-minimal.txt index bed27b83..61614d09 100644 --- a/adaa.analytics.rules/test/resources/reports/ClassificationExpertSnCTest/test_seismic-bumps.guided-c2, gimpuls_750 extended.seismic-bumps-train-minimal.txt +++ b/adaa.analytics.rules/test/resources/reports/ClassificationExpertSnCTest/test_seismic-bumps.guided-c2, gimpuls_750 extended.seismic-bumps-train-minimal.txt @@ -3,6 +3,4 @@ Rules IF [gimpuls = (-inf, 1350.50)] THEN class = {0} IF goenergy = <-32.50, inf) AND gimpuls = (-inf, 2784) AND goimpuls = <-39, 111) AND nbumps = (-inf, 5.50) THEN class = {0} - IF [gimpuls = <1350.50, inf)] AND genergy = (-inf, 344875) AND senergy = (-inf, 4650) THEN class = {1} - IF ghazard = {a} AND gimpuls = (-inf, 1758.50) AND goimpuls = (-inf, 10.50) AND genergy = <17495, inf) AND senergy = <2650, 8250) AND nbumps2 = <0.50, inf) THEN class = {1} - IF ghazard = {a} AND goenergy = <-21, 9) AND gimpuls = (-inf, 688.50) AND goimpuls = (-inf, 17.50) AND genergy = <24830, 36505) THEN class = {1} + IF [gimpuls = <408.50, inf)] AND ghazard = {a} AND goenergy = (-inf, 94.50) AND maxenergy = (-inf, 6500) AND genergy = <35165, 294530) AND senergy = (-inf, 8750) AND nbumps3 = (-inf, 2.50) THEN class = {1} diff --git a/adaa.analytics.rules/test/resources/reports/ClassificationExpertSnCTest/test_seismic-bumps.guided-c3, gimpuls_genergy_senergy.seismic-bumps-train-minimal.txt b/adaa.analytics.rules/test/resources/reports/ClassificationExpertSnCTest/test_seismic-bumps.guided-c3, gimpuls_genergy_senergy.seismic-bumps-train-minimal.txt index 75920acb..d17b1b2e 100644 --- a/adaa.analytics.rules/test/resources/reports/ClassificationExpertSnCTest/test_seismic-bumps.guided-c3, gimpuls_genergy_senergy.seismic-bumps-train-minimal.txt +++ b/adaa.analytics.rules/test/resources/reports/ClassificationExpertSnCTest/test_seismic-bumps.guided-c3, gimpuls_genergy_senergy.seismic-bumps-train-minimal.txt @@ -5,6 +5,4 @@ Rules IF [gimpuls = (-inf, 1350.50)] AND [senergy = (-inf, 5750)] AND goenergy = <-73.50, inf) AND nbumps = (-inf, 2.50) THEN class = {0} IF [gimpuls = (-inf, 1350.50)] AND [genergy = (-inf, 122140)] AND goenergy = <-73.50, inf) AND nbumps = (-inf, 5.50) THEN class = {0} IF [gimpuls = (-inf, 2784)] AND [senergy = (-inf, 5750)] AND goenergy = <-73.50, inf) AND goimpuls = (-inf, 107.50) THEN class = {0} - IF [gimpuls = <1350.50, inf)] AND [genergy = (-inf, 344875)] AND senergy = (-inf, 4650) THEN class = {1} - IF [genergy = <18890, inf)] AND [senergy = <950, inf)] AND ghazard = {a} AND goenergy = (-inf, 52.50) AND maxenergy = <1450, 45000) AND nbumps3 = (-inf, 2.50) AND nbumps2 = <0.50, inf) THEN class = {1} - IF [genergy = <18890, inf)] AND [gimpuls = <174.50, inf)] AND ghazard = {a} AND goenergy = (-inf, 9) AND maxenergy = (-inf, 6500) AND goimpuls = <-72, 17.50) THEN class = {1} + IF [genergy = <18890, inf)] AND [senergy = <950, inf)] AND ghazard = {a} AND goenergy = (-inf, 12) AND maxenergy = (-inf, 6500) AND gimpuls = (-inf, 1845.50) AND goimpuls = (-inf, 10.50) AND shift = {W} AND nbumps3 = <0.50, inf) THEN class = {1} diff --git a/adaa.analytics.rules/test/resources/reports/ClassificationExpertSnCTest/test_seismic-bumps.guided-c4, seismic OR seismoacoustic OR ghazard.seismic-bumps-train-minimal.txt b/adaa.analytics.rules/test/resources/reports/ClassificationExpertSnCTest/test_seismic-bumps.guided-c4, seismic OR seismoacoustic OR ghazard.seismic-bumps-train-minimal.txt index 127e951c..67b0aaf1 100644 --- a/adaa.analytics.rules/test/resources/reports/ClassificationExpertSnCTest/test_seismic-bumps.guided-c4, seismic OR seismoacoustic OR ghazard.seismic-bumps-train-minimal.txt +++ b/adaa.analytics.rules/test/resources/reports/ClassificationExpertSnCTest/test_seismic-bumps.guided-c4, seismic OR seismoacoustic OR ghazard.seismic-bumps-train-minimal.txt @@ -9,7 +9,4 @@ Rules IF [seismoacoustic = {a}] AND gimpuls = (-inf, 1350.50) AND goimpuls = <-39.50, inf) THEN class = {0} IF genergy = (-inf, 25125) AND nbumps = (-inf, 1.50) THEN class = {0} IF goenergy = <-73.50, inf) AND gimpuls = (-inf, 1350.50) AND nbumps = (-inf, 2.50) THEN class = {0} - IF [seismic = {b}] AND gimpuls = (-inf, 1878) AND genergy = <117615, 225545) THEN class = {1} - IF goenergy = <-41, inf) AND gimpuls = <1350.50, inf) AND maxenergy = (-inf, 45000) AND genergy = (-inf, 1158410) AND nbumps = (-inf, 3.50) THEN class = {1} - IF ghazard = {a} AND gimpuls = (-inf, 1758.50) AND goimpuls = (-inf, 10.50) AND genergy = <17495, inf) AND senergy = <2650, 8250) AND nbumps2 = <0.50, inf) THEN class = {1} - IF ghazard = {a} AND goenergy = <-21, 9) AND gimpuls = (-inf, 688.50) AND goimpuls = (-inf, 17.50) AND genergy = <24830, 36505) THEN class = {1} + IF [seismic = {b}] AND ghazard = {a} AND goenergy = <-39, 94.50) AND maxenergy = (-inf, 45000) AND genergy = <25125, inf) AND goimpuls = <-15.50, inf) THEN class = {1} diff --git a/adaa.analytics.rules/test/resources/reports/ClassificationExpertSnCTest/test_seismic-bumps.guided-c5, +seismic +nbumps +energy +maxenergy +shift.seismic-bumps-train-minimal.txt b/adaa.analytics.rules/test/resources/reports/ClassificationExpertSnCTest/test_seismic-bumps.guided-c5, +seismic +nbumps +energy +maxenergy +shift.seismic-bumps-train-minimal.txt index 9a05e6dd..272e798b 100644 --- a/adaa.analytics.rules/test/resources/reports/ClassificationExpertSnCTest/test_seismic-bumps.guided-c5, +seismic +nbumps +energy +maxenergy +shift.seismic-bumps-train-minimal.txt +++ b/adaa.analytics.rules/test/resources/reports/ClassificationExpertSnCTest/test_seismic-bumps.guided-c5, +seismic +nbumps +energy +maxenergy +shift.seismic-bumps-train-minimal.txt @@ -5,7 +5,4 @@ Rules IF goenergy = <-73.50, inf) AND nbumps = (-inf, 1.50) THEN class = {0} IF goenergy = <-73.50, inf) AND genergy = (-inf, 117615) AND nbumps2 = (-inf, 1.50) THEN class = {0} IF nbumps = (-inf, 5.50) THEN class = {0} - IF senergy = <2650, 3850) AND nbumps = <1.50, inf) THEN class = {1} - IF goenergy = (-inf, 11) AND genergy = <17495, 401025) AND senergy = <2650, 8250) AND nbumps2 = <0.50, inf) THEN class = {1} - IF goenergy = <-21, 9) AND genergy = <24830, 36280) AND senergy = (-inf, 1500) AND nbumps2 = (-inf, 0.50) THEN class = {1} - IF goenergy = (-inf, 50) AND maxenergy = (-inf, 45000) AND genergy = <62050, 1158410) AND nbumps = (-inf, 3.50) THEN class = {1} + IF goenergy = (-inf, 9) AND maxenergy = (-inf, 6500) AND genergy = <18890, 314675) AND shift = {W} AND nbumps3 = <0.50, inf) THEN class = {1} diff --git a/adaa.analytics.rules/test/resources/reports/ClassificationExpertSnCTest/test_seismic-bumps.guided-c6, +seismoacoustic +shift +genergy +gimpuls +genergy +goimpuls +ghazard.seismic-bumps-train-minimal.txt b/adaa.analytics.rules/test/resources/reports/ClassificationExpertSnCTest/test_seismic-bumps.guided-c6, +seismoacoustic +shift +genergy +gimpuls +genergy +goimpuls +ghazard.seismic-bumps-train-minimal.txt index 32b63904..fca2dab1 100644 --- a/adaa.analytics.rules/test/resources/reports/ClassificationExpertSnCTest/test_seismic-bumps.guided-c6, +seismoacoustic +shift +genergy +gimpuls +genergy +goimpuls +ghazard.seismic-bumps-train-minimal.txt +++ b/adaa.analytics.rules/test/resources/reports/ClassificationExpertSnCTest/test_seismic-bumps.guided-c6, +seismoacoustic +shift +genergy +gimpuls +genergy +goimpuls +ghazard.seismic-bumps-train-minimal.txt @@ -3,7 +3,4 @@ Rules IF gimpuls = (-inf, 1350.50) THEN class = {0} IF goenergy = <-32.50, inf) AND gimpuls = (-inf, 2784) AND goimpuls = <-39, 111) THEN class = {0} - IF gimpuls = <1350.50, 1507.50) AND genergy = (-inf, 792375) THEN class = {1} - IF genergy = <18890, 27830) AND goimpuls = (-inf, -35.50) THEN class = {1} - IF goenergy = <5, 9) AND genergy = <18890, inf) AND goimpuls = <1.50, inf) THEN class = {1} - IF goenergy = (-inf, -15) AND gimpuls = <387, inf) AND genergy = <24830, inf) AND goimpuls = (-inf, -5.50) AND seismoacoustic = {a} THEN class = {1} + IF ghazard = {a} AND goenergy = <-38.50, 9) AND gimpuls = <263, 1878) AND genergy = <24830, 314675) AND goimpuls = (-inf, 17.50) AND shift = {W} THEN class = {1}