Skip to content

Commit 1636f2b

Browse files
committed
Fixed very rare bug of model being dependent on the order in the nominal attribute mapping.
1 parent 1f93637 commit 1636f2b

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

adaa.analytics.rules/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ codeQuality {
2727
}
2828

2929
sourceCompatibility = 1.8
30-
version = '1.7.6'
30+
version = '1.7.7'
3131

3232

3333
jar {

adaa.analytics.rules/src/main/java/adaa/analytics/rules/logic/induction/ClassificationFinder.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ class TotalPosNeg {
684684
quality = modifier.modifyQuality(quality, attr.getName(), p, toCover_p);
685685
// prefer (gender = female) over (gender = !male) for boolean attributes
686686
if (quality > best.quality ||
687-
(quality == best.quality && (p > best.covered || best.opposite))) {
687+
(quality == best.quality && (p > best.covered || (p == best.covered && best.opposite)))) {
688688
ElementaryCondition candidate =
689689
new ElementaryCondition(attr.getName(), new SingletonSet((double) i, attr.getMapping().getValues()));
690690
if (checkCandidate(candidate, classId, p, n, toCover_p, P, uncoveredPositives.size(), rule.getRuleOrderNum())) {
@@ -741,7 +741,8 @@ class TotalPosNeg {
741741
for (Future f : futures) {
742742
ConditionEvaluation eval = (ConditionEvaluation)f.get();
743743

744-
Logger.log("\tAttribute best: " + eval.condition + ", quality=" + eval.quality + "\n", Level.FINEST);
744+
Logger.log("\tAttribute best: " + eval.condition + ", quality=" + eval.quality
745+
+ ", p=" + eval.covered + "\n", Level.FINEST);
745746

746747
if (best == null || eval.quality > best.quality || (eval.quality == best.quality && eval.covered > best.covered)) {
747748
best = eval;
@@ -755,7 +756,8 @@ class TotalPosNeg {
755756
if (best.condition != null) {
756757
Attribute bestAttr = trainSet.getAttributes().get(((ElementaryCondition)best.condition).getAttribute());
757758

758-
Logger.log("\tFinal best: " + best.condition + ", quality=" + best.quality + "\n", Level.FINEST);
759+
Logger.log("\tFinal best: " + best.condition + ", quality=" + best.quality
760+
+ ", p=" + best.covered + "\n", Level.FINEST);
759761

760762
if (bestAttr.isNominal()) {
761763
allowedAttributes.remove(bestAttr);

0 commit comments

Comments
 (0)