Class SubcontextList

  • All Implemented Interfaces:
    java.lang.Iterable<Subcontext>

    public class SubcontextList
    extends java.lang.Object
    implements java.lang.Iterable<Subcontext>
    This class creates and manages a list of subcontexts from a set of previously classified exemplars and an exemplar to be classified. After creating a list of subcontexts, iterate through the subcontexts using the Iterator returned by iterator().
    • Constructor Summary

      Constructors 
      Constructor Description
      SubcontextList​(Labeler labeler, java.util.List<weka.core.Instance> data, boolean ignoreFullMatches)
      This is the easiest to use constructor.
    • Constructor Detail

      • SubcontextList

        public SubcontextList​(Labeler labeler,
                              java.util.List<weka.core.Instance> data,
                              boolean ignoreFullMatches)
        This is the easiest to use constructor. It creates and stores a list of subcontexts given classified exemplars and an exemplar to be classified.
        Parameters:
        labeler - Labeler for assigning labels to items in data
        data - Training data (exemplars)
        ignoreFullMatches - if true, will not add entirely matching contexts
    • Method Detail

      • getCardinality

        public int getCardinality()
        Returns:
        the number of attributes used to predict an outcome
      • getIgnoreFullMatches

        public boolean getIgnoreFullMatches()
        Returns:
        True if instances with exact same attribute values as the test instance are removed from the list.
      • toString

        public java.lang.String toString()
        This method is not particularly speedy, since it sorts the contained subcontexts by label. It is meant for test purposes only; do not rely on exact output being the same in the future.
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object other)
        Returns equals if both lists contain the same data in the same subcontexts. Does not compare the Labeler object.
        Overrides:
        equals in class java.lang.Object
      • iterator

        public java.util.Iterator<Subcontext> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<Subcontext>
        Returns:
        An iterator which returns each of the contained subcontexts.
      • size

        public int size()
      • getConsideredExemplarCount

        public int getConsideredExemplarCount()
        Returns:
        The number of exemplars considered accepted into the list, e.g. added and not ignored
      • getLabeler

        public Labeler getLabeler()
        Returns:
        The labeler object used to assign incoming data to subcontexts.