Package weka.classifiers.lazy.AM.data
Class SubcontextList
- java.lang.Object
-
- weka.classifiers.lazy.AM.data.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 ofsubcontexts
from a set of previously classified exemplars and an exemplar to be classified. After creating a list of subcontexts, iterate through the subcontexts using theIterator
returned byiterator()
.
-
-
Constructor Summary
Constructors Constructor Description SubcontextList(Labeler labeler, java.util.List<weka.core.Instance> data, boolean ignoreFullMatches)
This is the easiest to use constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object other)
Returns equals if both lists contain the same data in the same subcontexts.int
getCardinality()
int
getConsideredExemplarCount()
boolean
getIgnoreFullMatches()
Labeler
getLabeler()
java.util.Iterator<Subcontext>
iterator()
int
size()
java.lang.String
toString()
This method is not particularly speedy, since it sorts the contained subcontexts by label.
-
-
-
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 datadata
- 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 classjava.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 classjava.lang.Object
-
iterator
public java.util.Iterator<Subcontext> iterator()
- Specified by:
iterator
in interfacejava.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.
-
-