Skip to content

Commit 2f7c7f6

Browse files
authored
Added boolean parameter for disabling apriori precision control (control_apriori_precision)
1 parent 288d1b6 commit 2f7c7f6

File tree

5 files changed

+18
-3
lines changed

5 files changed

+18
-3
lines changed

adaa.analytics.rules/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ codeQuality {
2727
}
2828

2929
sourceCompatibility = 1.8
30-
version = '1.5.1'
30+
version = '1.5.2'
3131

3232

3333
jar {

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,10 @@ protected ElementaryCondition induceCondition(
469469
Set<Integer> positives = rule.getCoveredPositives();
470470
double P = rule.getWeighted_P();
471471
double N = rule.getWeighted_N();
472-
double apriori_prec = P / (P + N);
472+
473+
double apriori_prec = params.isControlAprioriPrecision()
474+
? P / (P + N)
475+
: Double.MIN_VALUE;
473476

474477
List<Future<ConditionEvaluation>> futures = new ArrayList<Future<ConditionEvaluation>>();
475478

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,9 @@ protected ElementaryCondition induceCondition(
146146

147147
double classId = ((SingletonSet)rule.getConsequence().getValueSet()).getValue();
148148
Set<Integer> positives = rule.getCoveredPositives();
149-
double apriori_prec = rule.getWeighted_P() / (rule.getWeighted_P() + rule.getWeighted_N());
149+
double apriori_prec = params.isControlAprioriPrecision()
150+
? rule.getWeighted_P() / (rule.getWeighted_P() + rule.getWeighted_N())
151+
: Double.MIN_VALUE;
150152

151153
List<Future<ConditionEvaluation>> futures = new ArrayList<Future<ConditionEvaluation>>();
152154

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public class InductionParameters implements Serializable {
6060

6161
private int maxPassesCount = 1;
6262
private boolean meanBasedRegression = false;
63+
private boolean controlAprioriPrecision = true;
6364

6465
public IQualityMeasure getInductionMeasure() {return inductionMeasure;}
6566
public void setInductionMeasure(IQualityMeasure inductionMeasure) {this.inductionMeasure = inductionMeasure;}
@@ -114,6 +115,9 @@ public class InductionParameters implements Serializable {
114115
public boolean isMeanBasedRegression() { return meanBasedRegression; }
115116
public void setMeanBasedRegression(boolean value) { this.meanBasedRegression = value; }
116117

118+
public boolean isControlAprioriPrecision() { return controlAprioriPrecision; }
119+
public void setControlAprioriPrecision(boolean v) { controlAprioriPrecision = v; }
120+
117121
public List<Double> getMinimumCoveredAll_list() { return minimumCoveredAll_list; }
118122
public void setMinimumCoveredAll_list(List<Double> minimumCovered) {this.minimumCoveredAll_list.addAll(minimumCovered);}
119123

adaa.analytics.rules/src/main/java/adaa/analytics/rules/operator/RuleGenerator.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,8 @@ protected enum MeasureDestination {
167167

168168
public static final String PARAMETER_MEAN_BASED_REGRESSION = "mean_based_regression";
169169

170+
public static final String PARAMETER_CONTROL_APRORI_PRECISION = "control_apriori_precision";
171+
170172
/**
171173
* Invokes base class constructor.
172174
* @param description Operator description.
@@ -216,6 +218,7 @@ public Model learn(ExampleSet exampleSet) throws OperatorException {
216218
params.setMaxPassesCount(getParameterAsInt(PARAMETER_MAX_PASSES_COUNT));
217219
params.setBinaryContrastIncluded(getParameterAsBoolean(PARAMETER_INCLUDE_BINARY_CONTRAST));
218220
params.setMeanBasedRegression(getParameterAsBoolean(PARAMETER_MEAN_BASED_REGRESSION));
221+
params.setControlAprioriPrecision(getParameterAsBoolean(PARAMETER_CONTROL_APRORI_PRECISION));
219222

220223
String tmp = getParameterAsString(PARAMETER_MINCOV_ALL);
221224
if (tmp.length() > 0) {
@@ -406,6 +409,9 @@ PARAMETER_PENALTY_SATURATION, getParameterDescription(PARAMETER_PENALTY_SATURATI
406409
types.add(new ParameterTypeBoolean(PARAMETER_MEAN_BASED_REGRESSION, getParameterDescription(PARAMETER_MEAN_BASED_REGRESSION),
407410
defaultParams.isMeanBasedRegression()));
408411

412+
types.add(new ParameterTypeBoolean(PARAMETER_CONTROL_APRORI_PRECISION, getParameterDescription(PARAMETER_CONTROL_APRORI_PRECISION),
413+
defaultParams.isControlAprioriPrecision()));
414+
409415
return types;
410416
}
411417

0 commit comments

Comments
 (0)