Skip to content

Commit

Permalink
Removed strange mincov adjustment (results may change).
Browse files Browse the repository at this point in the history
  • Loading branch information
agudys committed Apr 5, 2024
1 parent 0a22c07 commit 1ade4f3
Show file tree
Hide file tree
Showing 13 changed files with 16 additions and 47 deletions.
2 changes: 1 addition & 1 deletion adaa.analytics.rules/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ codeQuality {
}

sourceCompatibility = 1.8
version = '1.7.10'
version = '1.7.11'


jar {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,10 +358,7 @@ protected Set<Attribute> names2attributes(Set<String> names, ExampleSet dataset)
return fractionCurrentGeneration * sizeToCover;
}else
{
return Math.min(
params.getAbsoluteMinimumCovered(size),
Math.max(1.0, 0.2 * size));

return params.getAbsoluteMinimumCovered(size);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Original file line number Diff line number Diff line change
Expand Up @@ -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}

0 comments on commit 1ade4f3

Please sign in to comment.