T
- The output type of this dataset.public final class DatasetView<T extends Output<T>> extends ImmutableDataset<T>
Dataset
that only exposes selected examples.
Does not copy the examples.Modifier and Type | Class and Description |
---|---|
static class |
DatasetView.DatasetViewProvenance
Provenance for the
DatasetView . |
dropInvalidExamples, featureIDMap, outputIDInfo
data, indices, outputFactory, sourceProvenance
Constructor and Description |
---|
DatasetView(Dataset<T> dataset,
int[] exampleIndices,
ImmutableFeatureMap featureIDs,
ImmutableOutputInfo<T> labelIDs,
String tag)
Creates a DatasetView which includes the supplied indices from the dataset.
|
DatasetView(Dataset<T> dataset,
int[] exampleIndices,
String tag)
Creates a DatasetView which includes the supplied indices from the dataset.
|
Modifier and Type | Method and Description |
---|---|
static <T extends Output<T>> |
createBootstrapView(Dataset<T> dataset,
int size,
long seed)
Generates a DatasetView bootstrapped from the supplied Dataset.
|
static <T extends Output<T>> |
createBootstrapView(Dataset<T> dataset,
int size,
long seed,
ImmutableFeatureMap featureIDs,
ImmutableOutputInfo<T> outputIDs)
Generates a DatasetView bootstrapped from the supplied Dataset.
|
static <T extends Output<T>> |
createView(Dataset<T> dataset,
Predicate<Example<T>> predicate,
String tag)
Creates a view from the supplied dataset, using the specified predicate to
test if each example should be in this view.
|
static <T extends Output<T>> |
createWeightedBootstrapView(Dataset<T> dataset,
int size,
long seed,
float[] exampleWeights)
Generates a DatasetView bootstrapped from the supplied Dataset using the supplied
example weights.
|
static <T extends Output<T>> |
createWeightedBootstrapView(Dataset<T> dataset,
int size,
long seed,
float[] exampleWeights,
ImmutableFeatureMap featureIDs,
ImmutableOutputInfo<T> outputIDs)
Generates a DatasetView bootstrapped from the supplied Dataset using the supplied
example weights.
|
List<Example<T>> |
getData()
Gets the examples as an unmodifiable list.
|
Example<T> |
getExample(int index)
Gets the example at the supplied index.
|
int[] |
getExampleIndices()
Returns a copy of the indicies used in this view.
|
ImmutableFeatureMap |
getFeatureMap()
Returns this dataset's
FeatureMap . |
ImmutableOutputInfo<T> |
getOutputInfo()
Returns this dataset's
OutputInfo . |
Set<T> |
getOutputs()
Gets the set of outputs that occur in the examples in this dataset.
|
DatasetView.DatasetViewProvenance |
getProvenance() |
Iterator<Example<T>> |
iterator() |
void |
setStoreIndices(boolean storeIndices)
Set to true to store the indices in the provenance system.
|
int |
size()
Gets the size of the data set.
|
boolean |
storeIndicesInProvenance()
Are the indices stored in the provenance system.
|
String |
toString() |
add, add, copyDataset, copyDataset, copyDataset, getDropInvalidExamples, getFeatureIDMap, getOutputIDInfo, hashFeatureMap
createTransformers, createTransformers, getOutputFactory, getSourceDescription, getSourceProvenance, shuffle
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public DatasetView(Dataset<T> dataset, int[] exampleIndices, String tag)
It uses the feature and output infos from the wrapped dataset.
dataset
- The dataset to wrap.exampleIndices
- The indices to present.tag
- A tag for the view.public DatasetView(Dataset<T> dataset, int[] exampleIndices, ImmutableFeatureMap featureIDs, ImmutableOutputInfo<T> labelIDs, String tag)
This takes the ImmutableFeatureMap and ImmutableOutputInfo parameters to save them being regenerated (e.g., in BaggingTrainer).
dataset
- The dataset to sample from.exampleIndices
- The indices of this view in the wrapped dataset.featureIDs
- The featureIDs to use for this dataset.labelIDs
- The labelIDs to use for this dataset.tag
- A tag for the view.public static <T extends Output<T>> DatasetView<T> createView(Dataset<T> dataset, Predicate<Example<T>> predicate, String tag)
T
- The type of the Output in the dataset.dataset
- The dataset to create a view over.predicate
- The predicate which determines if an example is in this view.tag
- A tag denoting what the predicate does.public static <T extends Output<T>> DatasetView<T> createBootstrapView(Dataset<T> dataset, int size, long seed)
T
- The type of the Output in the dataset.dataset
- The dataset to sample from.size
- The size of the sample.seed
- A seed for the RNG.public static <T extends Output<T>> DatasetView<T> createBootstrapView(Dataset<T> dataset, int size, long seed, ImmutableFeatureMap featureIDs, ImmutableOutputInfo<T> outputIDs)
This takes the ImmutableFeatureMap and ImmutableOutputInfo parameters to save them being regenerated.
T
- The type of the Output in the dataset.dataset
- The dataset to sample from.size
- The size of the sample.seed
- A seed for the RNG.featureIDs
- The featureIDs to use for this dataset.outputIDs
- The output info to use for this dataset.public static <T extends Output<T>> DatasetView<T> createWeightedBootstrapView(Dataset<T> dataset, int size, long seed, float[] exampleWeights)
T
- The type of the Output in the dataset.dataset
- The dataset to sample from.size
- The size of the sample.seed
- A seed for the RNG.exampleWeights
- The sampling weights for each example, must be in the range 0,1.public static <T extends Output<T>> DatasetView<T> createWeightedBootstrapView(Dataset<T> dataset, int size, long seed, float[] exampleWeights, ImmutableFeatureMap featureIDs, ImmutableOutputInfo<T> outputIDs)
This takes the ImmutableFeatureMap and ImmutableOutputInfo parameters to save them being regenerated.
T
- The type of the Output in the dataset.dataset
- The dataset to sample from.size
- The size of the sample.seed
- A seed for the RNG.exampleWeights
- The sampling weights for each example, must be in the range 0,1.featureIDs
- The featureIDs to use for this dataset.outputIDs
- The output info to use for this dataset.public boolean storeIndicesInProvenance()
public void setStoreIndices(boolean storeIndices)
storeIndices
- True if the indices should be stored in the provenance of this view.public String toString()
toString
in class ImmutableDataset<T extends Output<T>>
public Set<T> getOutputs()
getOutputs
in class ImmutableDataset<T extends Output<T>>
public int size()
public ImmutableFeatureMap getFeatureMap()
Dataset
FeatureMap
.getFeatureMap
in class ImmutableDataset<T extends Output<T>>
public ImmutableOutputInfo<T> getOutputInfo()
Dataset
OutputInfo
.getOutputInfo
in class ImmutableDataset<T extends Output<T>>
public List<Example<T>> getData()
Dataset
In other words, using the following to add additional examples to this dataset with throw an exception:
dataset.getData().add(example)
Instead, use MutableDataset.add(Example)
.
public Example<T> getExample(int index)
Dataset
Throws IllegalArgumentException if the index is invalid or outside the bounds.
getExample
in class Dataset<T extends Output<T>>
index
- The index of the example.public DatasetView.DatasetViewProvenance getProvenance()
getProvenance
in interface com.oracle.labs.mlrg.olcut.provenance.Provenancable<DatasetProvenance>
getProvenance
in class ImmutableDataset<T extends Output<T>>
public int[] getExampleIndices()
Copyright © 2015–2021 Oracle and/or its affiliates. All rights reserved.