public class MutableSequenceDataset<T extends Output<T>> extends SequenceDataset<T>
SequenceDataset
with a MutableFeatureMap
which grows over time.
Whenever an SequenceExample
is added to the dataset.Modifier and Type | Field and Description |
---|---|
protected boolean |
dense |
protected MutableFeatureMap |
featureMap
A map from feature names to IDs for the features found in this dataset.
|
protected MutableOutputInfo<T> |
outputInfo
A map from labels to IDs for the labels found in this dataset.
|
data, outputFactory, sourceProvenance
Constructor and Description |
---|
MutableSequenceDataset(DataProvenance sourceProvenance,
OutputFactory<T> outputFactory)
Creates an empty sequence dataset.
|
MutableSequenceDataset(ImmutableSequenceDataset<T> dataset) |
MutableSequenceDataset(Iterable<SequenceExample<T>> dataSource,
DataProvenance sourceProvenance,
OutputFactory<T> outputFactory)
Creates a dataset from a data source.
|
MutableSequenceDataset(SequenceDataSource<T> dataSource) |
Modifier and Type | Method and Description |
---|---|
void |
add(SequenceExample<T> ex)
Adds a
SequenceExample to this dataset. |
void |
addAll(Collection<SequenceExample<T>> collection)
Adds all the SequenceExamples in the supplied collection to this dataset.
|
void |
clear()
Clears all the examples out of this dataset, and flushes the FeatureMap, OutputInfo, and transform provenances.
|
void |
densify()
Iterates through the examples, converting implicit zeros into explicit zeros.
|
ImmutableFeatureMap |
getFeatureIDMap()
An immutable view on the feature map.
|
MutableFeatureMap |
getFeatureMap()
The feature map.
|
ImmutableOutputInfo<T> |
getOutputIDInfo()
An immutable view on the output info in this dataset.
|
OutputInfo<T> |
getOutputInfo()
The output info in this dataset.
|
Set<T> |
getOutputs()
Gets the set of labels that occur in the examples in this dataset.
|
DatasetProvenance |
getProvenance() |
boolean |
isDense()
Is the dataset dense (i.e., do all features in the domain have a value in each example).
|
String |
toString() |
getData, getExample, getFlatDataset, getOutputFactory, getSourceDescription, getSourceProvenance, iterator, size
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
protected final MutableOutputInfo<T extends Output<T>> outputInfo
protected final MutableFeatureMap featureMap
protected boolean dense
public MutableSequenceDataset(DataProvenance sourceProvenance, OutputFactory<T> outputFactory)
sourceProvenance
- A description of the input data, including preprocessing steps.outputFactory
- The output factory.public MutableSequenceDataset(Iterable<SequenceExample<T>> dataSource, DataProvenance sourceProvenance, OutputFactory<T> outputFactory)
dataSource
- The input data.sourceProvenance
- A description of the data, including preprocessing steps.outputFactory
- The output factory.public MutableSequenceDataset(SequenceDataSource<T> dataSource)
public MutableSequenceDataset(ImmutableSequenceDataset<T> dataset)
public void clear()
public void add(SequenceExample<T> ex)
SequenceExample
to this dataset.
It also canonicalises the reference to each feature's name (i.e., replacing the reference
to a feature's name with the canonical one stored in this Dataset's VariableInfo
).
This greatly reduces the memory footprint.
ex
- The example to add.public void addAll(Collection<SequenceExample<T>> collection)
collection
- The collection of SequenceExamples.public Set<T> getOutputs()
SequenceDataset
getOutputs
in class SequenceDataset<T extends Output<T>>
public ImmutableFeatureMap getFeatureIDMap()
SequenceDataset
getFeatureIDMap
in class SequenceDataset<T extends Output<T>>
public MutableFeatureMap getFeatureMap()
SequenceDataset
getFeatureMap
in class SequenceDataset<T extends Output<T>>
public ImmutableOutputInfo<T> getOutputIDInfo()
SequenceDataset
getOutputIDInfo
in class SequenceDataset<T extends Output<T>>
public OutputInfo<T> getOutputInfo()
SequenceDataset
getOutputInfo
in class SequenceDataset<T extends Output<T>>
public boolean isDense()
public void densify()
public DatasetProvenance getProvenance()
Copyright © 2015–2021 Oracle and/or its affiliates. All rights reserved.