Class IntLabeler


  • public class IntLabeler
    extends Labeler
    Analogical Modeling uses labels composed of boolean vectors in order to group instances into subcontexts and subcontexts in 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. For example, if we were classifying an instance <a, b, c>, and we had three training instances <x, y, c>, <w, m, c> and <a, b, z>, and used 'n' to represent mismatches and 'y' for matches, the labels would be <n, n, y>, <n, n, y>, and <y, y, n>. The current implementation takes advantage of binary arithmetic by representing mismatches as a 1 bit and matches as a 0 bit, all packed into a 32-bit integer.
    • Constructor Detail

      • IntLabeler

        public IntLabeler​(weka.core.Instance instance,
                          boolean ignoreUnknowns,
                          MissingDataCompare mdc)
        Throws:
        java.lang.IllegalArgumentException - if the cardinality of the input instance is greater than 32
    • Method Detail

      • label

        public IntLabel label​(weka.core.Instance data)
        Description copied from class: Labeler
        Create a context label for the input instance by comparing it with the test instance.
        Specified by:
        label in class Labeler
        Parameters:
        data - Instance to be labeled
        Returns:
        the label for the context that the instance belongs to. The cardinality of the label will be the same as the test and data items. At any given index i, label.matches(i) will return true if that feature is the same in the test and data instances.
      • getLatticeTop

        public Label getLatticeTop()
        Description copied from class: Labeler
        Creates and returns the label which belongs at the top of the boolean lattice formed by the subcontexts labeled by this labeler, i.e. the one for which every feature is a match.
        Specified by:
        getLatticeTop in class Labeler
        Returns:
        A label with all matches
      • getLatticeBottom

        public Label getLatticeBottom()
        Description copied from class: Labeler
        Creates and returns the label which belongs at the bottom of the boolean lattice formed by the subcontexts labeled by this labeler, i.e. the one for which every feature is a mismatch.
        Specified by:
        getLatticeBottom in class Labeler
        Returns:
        A label with all mismatches
      • fromBits

        public Label fromBits​(int labelBits)
        Description copied from class: Labeler
        For testing purposes, this method allows the client to directly specify the label using the bits of an integer
        Specified by:
        fromBits in class Labeler
      • partition

        public Label partition​(Label label,
                               int partitionIndex)
        Description copied from class: Labeler
        In distributed processing, it is necessary to split labels into partitions. This method returns a partition for the given label. A full label is partitioned into pieces 0 through Labeler.numPartitions(), so code to process labels in pieces should look like this:
                Label myLabel = myLabeler.label(myInstance);
                for(int i = 0; i < myLabeler.numPartitions(); i++)
                        process(myLabeler.partition(myLabel, i);
         
        Specified by:
        partition in class Labeler
        partitionIndex - index of the partition to return
        Returns:
        a new label representing a portion of the attributes represented by the input label.