Package weka.associations.tertius
Class LiteralSet
java.lang.Object
weka.associations.tertius.LiteralSet
- All Implemented Interfaces:
Serializable,Cloneable,RevisionHandler
Class representing a set of literals, being either the body or the head
of a rule.
- Version:
- $Revision: 1.7 $
- Author:
- Amelie Deltour
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor for a set that does not store its counter-instances.LiteralSet(Instances instances) Constructor initializing the set of counter-instances to all the instances. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddElement(Literal element) Add a Literal to this set.abstract booleanTest if an instance can be kept as a counter-instance, given a new literal.clone()Returns a shallow copy of this set.booleanTest if this LiteralSet contains a given Literal.booleancounterInstance(Instance instance) Test if an instance is a counter-instance of this LiteralSet.booleancounterInstance(Instance individual, Instance part) Test if an individual instance, given a part instance of this individual, is a counter-instance of this LiteralSet.final IteratorEnumerate the literals contained in this set.doubleGet the frequency of counter-instances of this LiteralSet in the data.intGet the number of counter-instances of this LiteralSet.Give the last literal added to this set.intgetType()Give the type of properties in this set (individual or part properties).booleanTest if all the intances are counter-instances.final booleanisEmpty()Test if this set is empty.abstract booleanisIncludedIn(Rule otherRule) Test if this LiteralSet is included in a rule.booleannegationIncludedIn(LiteralSet otherSet) Test if the negation of this LiteralSet is included in another LiteralSet.final intGive the number of literals in this set.booleanoverFrequencyThreshold(double minFrequency) Test if this LiteralSet has more counter-instances than the threshold.abstract StringtoString()Gives a String representation for this set of literals.voidUpdate the number of counter-instances of this set in the dataset.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface weka.core.RevisionHandler
getRevision
-
Constructor Details
-
LiteralSet
public LiteralSet()Constructor for a set that does not store its counter-instances. -
LiteralSet
Constructor initializing the set of counter-instances to all the instances.- Parameters:
instances- The dataset.
-
-
Method Details
-
clone
Returns a shallow copy of this set. The structured is copied but the literals themselves are not copied.- Returns:
- A copy of this LiteralSet.
-
upDate
Update the number of counter-instances of this set in the dataset. This method should be used is the set does not store its counter-instances.- Parameters:
instances- The dataset.
-
getCounterInstancesNumber
public int getCounterInstancesNumber()Get the number of counter-instances of this LiteralSet.- Returns:
- The number of counter-instances.
-
getCounterInstancesFrequency
public double getCounterInstancesFrequency()Get the frequency of counter-instances of this LiteralSet in the data.- Returns:
- The frequency of counter-instances.
-
overFrequencyThreshold
public boolean overFrequencyThreshold(double minFrequency) Test if this LiteralSet has more counter-instances than the threshold.- Parameters:
minFrequency- The frequency threshold.- Returns:
- True if there are more counter-instances than the threshold.
-
hasMaxCounterInstances
public boolean hasMaxCounterInstances()Test if all the intances are counter-instances.- Returns:
- True if all the instances are counter-instances.
-
addElement
Add a Literal to this set.- Parameters:
element- The element to add.
-
isEmpty
public final boolean isEmpty()Test if this set is empty.- Returns:
- True if the set is empty.
-
numLiterals
public final int numLiterals()Give the number of literals in this set.- Returns:
- The number of literals.
-
enumerateLiterals
Enumerate the literals contained in this set.- Returns:
- An Iterator for the literals.
-
getLastLiteral
Give the last literal added to this set.- Returns:
- The last literal added.
-
negationIncludedIn
Test if the negation of this LiteralSet is included in another LiteralSet.- Parameters:
otherSet- The other LiteralSet.- Returns:
- True if the negation of this LiteralSet is included in the other LiteralSet.
-
contains
Test if this LiteralSet contains a given Literal.- Parameters:
lit- The literal that is looked for.- Returns:
- True if this literal is contained in this LiteralSet.
-
getType
public int getType()Give the type of properties in this set (individual or part properties). -
counterInstance
Test if an individual instance, given a part instance of this individual, is a counter-instance of this LiteralSet.- Parameters:
individual- The individual instance.part- The part instance.- Returns:
- True if the individual is a counter-instance.
-
counterInstance
Test if an instance is a counter-instance of this LiteralSet.- Parameters:
instance- The instance to test.- Returns:
- True if the instance is a counter-instance.
-
canKeep
Test if an instance can be kept as a counter-instance, given a new literal.- Parameters:
instance- The instance to test.newLit- The new literal.- Returns:
- True if the instance is still a counter-instance.
-
isIncludedIn
Test if this LiteralSet is included in a rule.- Parameters:
otherRule- The rule to test.- Returns:
- True if this set of literals is included in the rule.
-
toString
Gives a String representation for this set of literals.
-