Class Label

  • Direct Known Subclasses:
    BitSetLabel, IntLabel, LongLabel

    public abstract class Label
    extends java.lang.Object
    Analogical Modeling uses labels composed of boolean vectors in order to group instances into subcontexts and subcontexts into supracontexts. Training set instances are assigned labels by comparing them with the instance to be classified and encoding matched attributes and mismatched attributes in a boolean vector. Labels should implement equals() and hashCode() for use in hashed collections; however, Labels of two different classes do not have to be equals() or have equal hashCodes, even if the information they contain is equivalent.
    • Constructor Summary

      Constructors 
      Constructor Description
      Label()  
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      abstract boolean allMatching()  
      abstract java.util.Iterator<Label> descendantIterator()
      The "descendants" of a label are the set of labels with the same "mismatch" entries, but with one or more of the "match" entries changed into a "mismatch" entry.
      abstract int getCardinality()  
      abstract Label intersect​(Label otherLabel)
      Create a new label for which each location is marked as a match if both this label and otherLabel are marked match, otherwise mismatch.
      abstract boolean isDescendantOf​(Label possibleAncestor)
      Determine if this label is the "descendant" of possibleAncestor.
      abstract boolean matches​(int index)
      Determine if the given index is marked as a match or a mismatch.
      abstract int numMatches()  
      abstract Label union​(Label other)
      Create a new label for which each location is marked as a match if either this label or other is marked match, otherwise mismatch.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Label

        public Label()
    • Method Detail

      • getCardinality

        public abstract int getCardinality()
        Returns:
        The number of attributes represented in this label.
      • matches

        public abstract boolean matches​(int index)
        Determine if the given index is marked as a match or a mismatch.
        Parameters:
        index - Index of the attribute being represented
        Returns:
        True if the index is a match, false otherwise.
        Throws:
        java.lang.IllegalArgumentException - if the index is less than 0 or greater than getCardinality() - 1.
      • numMatches

        public abstract int numMatches()
        Returns:
        The total number of matches marked in this label.
      • descendantIterator

        public abstract java.util.Iterator<Label> descendantIterator()
        The "descendants" of a label are the set of labels with the same "mismatch" entries, but with one or more of the "match" entries changed into a "mismatch" entry. For example, the children of {match, mismatch, mismatch, match} are:
        • {mismatch, mismatch, mismatch, match},
        • {match, mismatch, mismatch, mismatch}, and
        • {mismatch, mismatch, mismatch, mismatch}
        .
        Returns:
        An iterator over the label descendants
      • isDescendantOf

        public abstract boolean isDescendantOf​(Label possibleAncestor)
        Determine if this label is the "descendant" of possibleAncestor. This label is a descendant of the other label if every mismatching entry in the other label is also a mismatching entry in this label. Any label is also a descendant of itself.
        Parameters:
        possibleAncestor - possible label ancestor
        Returns:
        true if possibleAncestor is an ancestor of this label; false otherwise.
      • intersect

        public abstract Label intersect​(Label otherLabel)
        Create a new label for which each location is marked as a match if both this label and otherLabel are marked match, otherwise mismatch. In other words, keep all mismatches from both labels.
        Parameters:
        otherLabel - the label to intersect with this one
        Returns:
        an intersected label
      • union

        public abstract Label union​(Label other)
        Create a new label for which each location is marked as a match if either this label or other is marked match, otherwise mismatch. In other words, keep all matches from both labels.
      • allMatching

        public abstract boolean allMatching()
        Returns:
        true if every feature of this label is a match (i.e. this is the top of the lattice; false otherwise