edu.cmu.minorthird.classify.sequential
Class MutableCandidateSegmentGroup

java.lang.Object
  extended by edu.cmu.minorthird.classify.sequential.MutableCandidateSegmentGroup
All Implemented Interfaces:
HasSubpopulationId, CandidateSegmentGroup

public class MutableCandidateSegmentGroup
extends java.lang.Object
implements CandidateSegmentGroup

A group of sliding windows associated with a sequence.

In more detail: just as a SequenceDataset holds a set of Example[] objects, a SegmentDataset holds a set of CandidateSegmentGroup objects. Each CandidateSegmentGroup is derived from a sequence of source objects s1....sN. The CandidateSegmentGroup holds an instance for each subsequence of up to K adjacent source objects (the subsequence is called a segment, or a sliding window). Here K is the "maxWindowSize", and N is the "sequenceLength".

To illustrate, suppose the original sequence is a,b,c,d,e and K=3. Then the sliding window will hold instances created from these subsequences: a,b,c,d,e,ab,bc,cd,de,abc,bcd,cde.

Author:
William Cohen

Constructor Summary
MutableCandidateSegmentGroup(int maxWindowSize, int sequenceLength)
          Creates a new holder for sliding-window instances.
 
Method Summary
 java.util.Set<java.lang.String> classNameSet()
          Return the set of strings associated with ClassLabels on any of the stored segments.
 int getMaxWindowSize()
          Return the maximum segment length.
 int getSequenceLength()
          Return the length of the original sequence that the segments were derived from.
 java.lang.String getSubpopulationId()
          Return the subpopulationId for the original sequence.
 Example getSubsequenceExample(int start, int end)
          Return the example corresponding to the segment from positions start..end
 Instance getSubsequenceInstance(int start, int end)
          Return the instance corresponding to the segment from positions start...end.
 ClassLabel getSubsequenceLabel(int start, int end)
          Return the class label associated with getSubsequenceExample(start,end).
 void setSubsequence(int start, int end, Instance newInstance)
          Specify the Instance associated with positions start...end.
 void setSubsequence(int start, int end, Instance newInstance, ClassLabel newLabel)
          Specify the Instance associated with positions start...end, and associate the label with that Instance.
 int size()
          Number of instances stored.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MutableCandidateSegmentGroup

public MutableCandidateSegmentGroup(int maxWindowSize,
                                    int sequenceLength)
Creates a new holder for sliding-window instances.

Parameters:
maxWindowSize - the maximum length of any sliding window
sequenceLength - the length of the original sequence
Method Detail

setSubsequence

public void setSubsequence(int start,
                           int end,
                           Instance newInstance,
                           ClassLabel newLabel)
Specify the Instance associated with positions start...end, and associate the label with that Instance.

Parameters:
start - starting position of segment in the original sequence from which newInstance was derived.
end - ending position, using Java conventions--e.g., start=2 and end=3 is a segment containing one element, which had index 2 in the original sequence.

setSubsequence

public void setSubsequence(int start,
                           int end,
                           Instance newInstance)
Specify the Instance associated with positions start...end.


getSubsequenceExample

public Example getSubsequenceExample(int start,
                                     int end)
Description copied from interface: CandidateSegmentGroup
Return the example corresponding to the segment from positions start..end

Specified by:
getSubsequenceExample in interface CandidateSegmentGroup

getSubsequenceLabel

public ClassLabel getSubsequenceLabel(int start,
                                      int end)
Return the class label associated with getSubsequenceExample(start,end).

Specified by:
getSubsequenceLabel in interface CandidateSegmentGroup

getSubsequenceInstance

public Instance getSubsequenceInstance(int start,
                                       int end)
Return the instance corresponding to the segment from positions start...end.

Specified by:
getSubsequenceInstance in interface CandidateSegmentGroup

getSequenceLength

public int getSequenceLength()
Description copied from interface: CandidateSegmentGroup
Return the length of the original sequence that the segments were derived from.

Specified by:
getSequenceLength in interface CandidateSegmentGroup

getMaxWindowSize

public int getMaxWindowSize()
Description copied from interface: CandidateSegmentGroup
Return the maximum segment length.

Specified by:
getMaxWindowSize in interface CandidateSegmentGroup

getSubpopulationId

public java.lang.String getSubpopulationId()
Description copied from interface: CandidateSegmentGroup
Return the subpopulationId for the original sequence.

Specified by:
getSubpopulationId in interface HasSubpopulationId
Specified by:
getSubpopulationId in interface CandidateSegmentGroup

size

public int size()
Description copied from interface: CandidateSegmentGroup
Number of instances stored.

Specified by:
size in interface CandidateSegmentGroup

classNameSet

public java.util.Set<java.lang.String> classNameSet()
Description copied from interface: CandidateSegmentGroup
Return the set of strings associated with ClassLabels on any of the stored segments.

Specified by:
classNameSet in interface CandidateSegmentGroup

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object