nl.liacs.subdisc
Class SubgroupSet

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractSet<E>
          extended by java.util.TreeSet<Subgroup>
              extended by nl.liacs.subdisc.SubgroupSet
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<Subgroup>, java.util.Collection<Subgroup>, java.util.NavigableSet<Subgroup>, java.util.Set<Subgroup>, java.util.SortedSet<Subgroup>

public class SubgroupSet
extends java.util.TreeSet<Subgroup>

A SubgroupSet is a TreeSet of Subgroups. If its size is set to <= 0, the SubgroupSet has no maximum size, else the number of Subgroups it can contain is limited by its size. In a nominal target setting (TargetType) a ROCList can be obtained from this SubgroupSet to create a ROCCurve in a ROCCurveWindow.

See Also:
ROCList, ROCCurve, ROCCurveWindow, Subgroup, Serialized Form

Field Summary
static java.lang.Object[] ROC_HEADER
           
 
Constructor Summary
SubgroupSet(int theSize)
          Create a SubgroupSet of a certain size.
SubgroupSet(int theSize, int theTotalCoverage, java.util.BitSet theBinaryTarget)
          Creates a SubgroupSet of a certain size, but in a nominal target setting theTotalCoverage and theBinaryTarget should also be set.
SubgroupSet(SubgroupSet theOriginal)
          Creates a SubgroupSet just like the argument, except empty.
 
Method Summary
 boolean add(Subgroup theSubgroup)
          Tries to add the Subgroup passed in as parameter to this SubgroupSet.
 int computeCoverCount(SubgroupSet theSet, int theRow)
          Computes the cover count of a particular example: the number of times this example is a member of a subgroup See van Leeuwen & Knobbe, ECML PKDD 2011
 double computeMultiplicativeWeight(SubgroupSet theSet, Subgroup theSubgroup)
          Computes the multiplicative weight of a subgroup \n See van Leeuwen & Knobbe, ECML PKDD 2011.
 Subgroup getBestSubgroup()
           
 java.util.BitSet getBinaryTargetClone()
          Returns a copy of this SubgroupSets' BinaryTarget BitSet.
 ROCList getROCList()
          Returns a new ROCList.
 java.lang.Object[][] getROCListSubgroups()
           
 int getTotalCoverage()
           
 float getTotalTargetCoverage()
           
 SubgroupSet postProcess(SearchStrategy theSearchStrategy)
           
 void print()
           
 void saveExtent(java.io.BufferedWriter theWriter, Table theTable, java.util.BitSet theSubset, TargetConcept theTargetConcept)
           
 void setIDs()
           
 
Methods inherited from class java.util.TreeSet
addAll, ceiling, clear, clone, comparator, contains, descendingIterator, descendingSet, first, floor, headSet, headSet, higher, isEmpty, iterator, last, lower, pollFirst, pollLast, remove, size, subSet, subSet, tailSet, tailSet
 
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
 
Methods inherited from class java.util.AbstractCollection
containsAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
containsAll, equals, hashCode, removeAll, retainAll, toArray, toArray
 

Field Detail

ROC_HEADER

public static final java.lang.Object[] ROC_HEADER
Constructor Detail

SubgroupSet

public SubgroupSet(int theSize)
Create a SubgroupSet of a certain size.

Parameters:
theSize - the size of this SubgroupSet, use theSize <= 0 for no maximum size.

SubgroupSet

public SubgroupSet(int theSize,
                   int theTotalCoverage,
                   java.util.BitSet theBinaryTarget)
Creates a SubgroupSet of a certain size, but in a nominal target setting theTotalCoverage and theBinaryTarget should also be set.

Parameters:
theSize - the size of this SubgroupSet, use theSize <= 0 for no maximum size.
theTotalCoverage - the total number of instances in the data (number of rows in the Table).
theBinaryTarget - a BitSet with bits set for the instances covered by the target value.

SubgroupSet

public SubgroupSet(SubgroupSet theOriginal)
Creates a SubgroupSet just like the argument, except empty.

Method Detail

add

public boolean add(Subgroup theSubgroup)
Tries to add the Subgroup passed in as parameter to this SubgroupSet. Also ensures this SubgroupSet never exceeds its maximum size (if one is set).

Specified by:
add in interface java.util.Collection<Subgroup>
Specified by:
add in interface java.util.Set<Subgroup>
Overrides:
add in class java.util.TreeSet<Subgroup>
Parameters:
theSubgroup - theSubgroup to add to this SubgroupSet.
Returns:
true if this SubgroupSet did not already contain the specified SubGroup, false otherwise and if the Subgroup is null.

getBestSubgroup

public Subgroup getBestSubgroup()

setIDs

public void setIDs()

print

public void print()

saveExtent

public void saveExtent(java.io.BufferedWriter theWriter,
                       Table theTable,
                       java.util.BitSet theSubset,
                       TargetConcept theTargetConcept)

getBinaryTargetClone

public java.util.BitSet getBinaryTargetClone()
Returns a copy of this SubgroupSets' BinaryTarget BitSet. SubgroupSets only have a BinaryTarget BitSet in a nominal target setting, meaning the AttributeType of the PrimaryTarget in the TargetConcept is of type AttributeType.NOMINAL.

Returns:
a clone of this SubgroupSets' BinaryTarget BitSet, or null if this SubgroupSet has no BinaryTarget BitSet.

getTotalCoverage

public int getTotalCoverage()

getTotalTargetCoverage

public float getTotalTargetCoverage()

postProcess

public SubgroupSet postProcess(SearchStrategy theSearchStrategy)

computeCoverCount

public int computeCoverCount(SubgroupSet theSet,
                             int theRow)
Computes the cover count of a particular example: the number of times this example is a member of a subgroup See van Leeuwen & Knobbe, ECML PKDD 2011


computeMultiplicativeWeight

public double computeMultiplicativeWeight(SubgroupSet theSet,
                                          Subgroup theSubgroup)
Computes the multiplicative weight of a subgroup \n See van Leeuwen & Knobbe, ECML PKDD 2011.


getROCList

public ROCList getROCList()
Returns a new ROCList. If Subgroups are removed from this SubgroupSet, this new ROCList reflects these changes. This method only returns a ROCList in a nominal target setting, meaning the AttributeType of the PrimaryTarget in the TargetConcept is of type AttributeType.NOMINAL.

Returns:
a ROCList, or null if not in a nominal target setting.

getROCListSubgroups

public java.lang.Object[][] getROCListSubgroups()