Class Rule
java.lang.Object
adaa.analytics.rules.logic.representation.rule.Rule
- All Implemented Interfaces:
Serializable
,Cloneable
- Direct Known Subclasses:
ClassificationRule
,RegressionRule
,SurvivalRule
Abstract class representing all kinds of rules (classification/regression/survival).
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ElementaryCondition
Rule consequence.protected IntegerBitSet
Set of covered negatives.protected IntegerBitSet
Set of covered positives.protected int
Number of induced conditions.protected CompoundCondition
Rule premise.protected double
Rule significance.protected int
Rule order number.protected double
Rule weight.double
Number of negatives covered by the rule (accounting weights).double
Number of negatives in the training set (accounting weights).double
Number of positives covered by the rule (accounting weights).double
Number of positives in the training set (accounting weights). -
Constructor Summary
ConstructorsConstructorDescriptionRule()
Creates empty rule.Rule
(CompoundCondition premise, ElementaryCondition consequence) Creates a rule with a given premise and a consequence.Creates new rule on the basis of the reference one (incomplete shallow copy). -
Method Summary
Modifier and TypeMethodDescriptionclone()
void
abstract Covering
covers
(IExampleSet set) Deprecated.void
covers
(IExampleSet set, ContingencyTable ct) Applies the rule on a specified example set.void
covers
(IExampleSet set, ContingencyTable ct, Set<Integer> positives, Set<Integer> negatives) Applies the rule on a specified example set.abstract Covering
covers
(IExampleSet set, Set<Integer> filterIds) Deprecated.Gets indices of covered examples without positive/negative distinction.boolean
Getsconsequence
GetscoveredNegatives
GetscoveredPositives
Gets covering object containing p,n,P,N.int
Getspremise
double
Getspvalue
int
double
Getsweight
double
Getsweighted_n
double
Getsweighted_N
double
Getsweighted_p
double
Getsweighted_P
Generates statistics in a text form.void
void
Setsconsequence
void
SetscoveredNegatives
void
SetscoveredPositives
void
Sets p,n,P,N on the basis of covering information.void
setInducedContitionsCount
(int v) void
Setspremise
void
setPValue
(double v) Setspvalue
void
setRuleOrderNum
(int ruleOrderNum) void
setWeight
(double v) Setsweight
void
setWeighted_n
(double v) Setsweighted_n
void
setWeighted_N
(double v) Setsweighted_N
void
setWeighted_p
(double v) Setsweighted_p
void
setWeighted_P
(double v) Setsweighted_P
toString()
Generates a text representation of the rule.toTable()
Converts a rule to semicolon-separated tabular form with selected statistics.abstract void
updateWeightAndPValue
(IExampleSet trainSet, ContingencyTable ct, IQualityMeasure votingMeasure)
-
Field Details
-
stats
-
premise
Rule premise. -
consequence
Rule consequence. -
weighted_p
public double weighted_pNumber of positives covered by the rule (accounting weights). -
weighted_n
public double weighted_nNumber of negatives covered by the rule (accounting weights). -
weighted_P
public double weighted_PNumber of positives in the training set (accounting weights). -
weighted_N
public double weighted_NNumber of negatives in the training set (accounting weights). -
weight
protected double weightRule weight. -
pvalue
protected double pvalueRule significance. -
ruleOrderNum
protected int ruleOrderNumRule order number. -
inducedConditionsCount
protected int inducedConditionsCountNumber of induced conditions. -
coveredPositives
Set of covered positives. -
coveredNegatives
Set of covered negatives.
-
-
Constructor Details
-
Rule
public Rule()Creates empty rule. -
Rule
Creates a rule with a given premise and a consequence.- Parameters:
premise
- Rule premise.consequence
- Rule consequence.
-
Rule
Creates new rule on the basis of the reference one (incomplete shallow copy).- Parameters:
ref
- Reference rule
-
-
Method Details
-
getPremise
Getspremise
-
setPremise
Setspremise
-
getConsequence
Getsconsequence
-
setConsequence
Setsconsequence
-
getWeighted_p
public double getWeighted_p()Getsweighted_p
-
setWeighted_p
public void setWeighted_p(double v) Setsweighted_p
-
getWeighted_n
public double getWeighted_n()Getsweighted_n
-
setWeighted_n
public void setWeighted_n(double v) Setsweighted_n
-
getWeighted_P
public double getWeighted_P()Getsweighted_P
-
setWeighted_P
public void setWeighted_P(double v) Setsweighted_P
-
getWeighted_N
public double getWeighted_N()Getsweighted_N
-
setWeighted_N
public void setWeighted_N(double v) Setsweighted_N
-
getWeight
public double getWeight()Getsweight
-
setWeight
public void setWeight(double v) Setsweight
-
getInducedConditionsCount
public int getInducedConditionsCount() -
setInducedContitionsCount
public void setInducedContitionsCount(int v) -
getRuleOrderNum
public int getRuleOrderNum() -
setRuleOrderNum
public void setRuleOrderNum(int ruleOrderNum) -
getPValue
public double getPValue()Getspvalue
-
setPValue
public void setPValue(double v) Setspvalue
-
getCoveredPositives
GetscoveredPositives
-
setCoveredPositives
SetscoveredPositives
-
getCoveredNegatives
GetscoveredNegatives
-
setCoveredNegatives
SetscoveredNegatives
-
getStat
-
putStat
-
setCoveringInformation
Sets p,n,P,N on the basis of covering information.- Parameters:
cov
- Covering information.
-
getCoveringInformation
Gets covering object containing p,n,P,N.- Returns:
- Covering information.
-
covers
Deprecated.Applies the rule on a part of a specified example set.- Parameters:
set
- Example set.filterIds
- Set of identifiers to be examined.- Returns:
- Information about covering.
-
coversUnlabelled
Gets indices of covered examples without positive/negative distinction.- Parameters:
set
- Example set to be examined.- Returns:
- Set of indices of covered examples.
-
covers
Deprecated.Applies the rule on a specified example set.- Parameters:
set
- Example set.- Returns:
- Information about covering.
-
updateWeightAndPValue
public abstract void updateWeightAndPValue(IExampleSet trainSet, ContingencyTable ct, IQualityMeasure votingMeasure) - Parameters:
trainSet
- Training set.ct
- Contingency table.votingMeasure
- Measure used as weight.
-
covers
Applies the rule on a specified example set.- Parameters:
set
- Example set.ct
- Output contingency table.
-
covers
public void covers(IExampleSet set, ContingencyTable ct, Set<Integer> positives, Set<Integer> negatives) Applies the rule on a specified example set.- Parameters:
set
- Example set.ct
- Output contingency table.positives
- Output collection of covered positive ids.negatives
- Output collection of covered negative ids.
-
toString
Generates a text representation of the rule. -
printStats
Generates statistics in a text form.- Returns:
- Rule statistics.
-
getTableHeader
-
toTable
Converts a rule to semicolon-separated tabular form with selected statistics.- Returns:
- Tabular rule representation.
-
clone
- Overrides:
clone
in classObject
- Throws:
CloneNotSupportedException
-
equals
-
copyFrom
-