Package org.tribuo.sequence
Class SequenceDataset<T extends Output<T>>
java.lang.Object
org.tribuo.sequence.SequenceDataset<T>
- Type Parameters:
T
- the type of the outputs in the data set.
- All Implemented Interfaces:
com.oracle.labs.mlrg.olcut.provenance.Provenancable<DatasetProvenance>
,Serializable
,Iterable<SequenceExample<T>>
- Direct Known Subclasses:
ImmutableSequenceDataset
,MutableSequenceDataset
public abstract class SequenceDataset<T extends Output<T>>
extends Object
implements Iterable<SequenceExample<T>>, com.oracle.labs.mlrg.olcut.provenance.Provenancable<DatasetProvenance>, Serializable
A class for sets of data, which are used to train and evaluate classifiers.
Subclass either MutableSequenceDataset
or ImmutableSequenceDataset
rather than this class.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected final List<SequenceExample<T>>
The data in this data set.protected final OutputFactory<T>
A factory for makingOutputInfo
andOutput
of the appropriate type.protected final DataProvenance
The provenance of the data source, extracted on construction. -
Constructor Summary
ModifierConstructorDescriptionprotected
SequenceDataset
(DataProvenance sourceProvenance, OutputFactory<T> outputFactory) -
Method Summary
Modifier and TypeMethodDescriptiongetData()
Returns an unmodifiable view on the data.getExample
(int index) Gets the example at the specified index, or throws IllegalArgumentException if the index is out of bounds.abstract ImmutableFeatureMap
An immutable view on the feature map.abstract FeatureMap
The feature map.Returns a view on this SequenceDataset which aggregates all the examples and ignores the sequence structure.Gets the output factory.abstract ImmutableOutputInfo<T>
An immutable view on the output info in this dataset.abstract OutputInfo<T>
The output info in this dataset.Gets the set of labels that occur in the examples in this dataset.Returns the description of the source provenance.Returns the source provenance.iterator()
int
size()
Gets the size of the data set.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface com.oracle.labs.mlrg.olcut.provenance.Provenancable
getProvenance
-
Field Details
-
outputFactory
A factory for makingOutputInfo
andOutput
of the appropriate type. -
data
The data in this data set. -
sourceProvenance
The provenance of the data source, extracted on construction.
-
-
Constructor Details
-
SequenceDataset
-
-
Method Details
-
getSourceDescription
Returns the description of the source provenance.- Returns:
- The source provenance in text form.
-
getData
Returns an unmodifiable view on the data.- Returns:
- The data.
-
getSourceProvenance
Returns the source provenance.- Returns:
- The source provenance.
-
getOutputs
Gets the set of labels that occur in the examples in this dataset.- Returns:
- the set of labels that occur in the examples in this dataset.
-
getExample
Gets the example at the specified index, or throws IllegalArgumentException if the index is out of bounds.- Parameters:
index
- The index.- Returns:
- The example at that index.
-
getFlatDataset
Returns a view on this SequenceDataset which aggregates all the examples and ignores the sequence structure.- Returns:
- A flattened view on this dataset.
-
size
public int size()Gets the size of the data set.- Returns:
- the size of the data set.
-
getOutputIDInfo
An immutable view on the output info in this dataset.- Returns:
- The output info.
-
getOutputInfo
The output info in this dataset.- Returns:
- The output info.
-
getFeatureIDMap
An immutable view on the feature map.- Returns:
- The feature map.
-
getFeatureMap
The feature map.- Returns:
- The feature map.
-
getOutputFactory
Gets the output factory.- Returns:
- The output factory.
-
iterator
-
toString
-