Interface Dataset<D,T>
- Type Parameters:
D- the data type.T- the target type.
- All Superinterfaces:
Iterable<SampleInstance<D,T>>
- All Known Implementing Classes:
BinarySparseDataset, BinarySparseSequenceDataset, SimpleDataset, SparseDataset
An immutable collection of data objects.
-
Method Summary
Modifier and TypeMethodDescriptiondefault SampleInstance<D, T> apply(int i) Returns the index at the specified index.default Iterator<List<SampleInstance<D, T>>> batch(int size) Returns an iterator of mini-batches.get(int i) Returns the instance at the specified index.default booleanisEmpty()Returns true if the dataset is empty.of(D[] data, double[] target) Returns a default implementation of Dataset from a collection.of(D[] data, float[] target) Returns a default implementation of Dataset from a collection.of(D[] data, int[] target) Returns a default implementation of Dataset from a collection.static <D,T> Dataset <D, T> of(D[] data, T[] target) Returns a default implementation of Dataset from a collection.static <D,T> Dataset <D, T> of(Collection<SampleInstance<D, T>> instances) Returns a default implementation of Dataset from a collection.static <D,T> Dataset <D, T> Returns a default implementation of Dataset from a collection.intsize()Returns the number of elements in this collection.stream()Returns a (possibly parallel) Stream with this collection as its source.default List<SampleInstance<D, T>> toList()Returns theListof data items.default StringtoString(int numRows) Returns the string representation of the dataset.Methods inherited from interface Iterable
forEach, iterator, spliterator
-
Method Details
-
size
int size()Returns the number of elements in this collection.- Returns:
- the number of elements in this collection.
-
isEmpty
default boolean isEmpty()Returns true if the dataset is empty.- Returns:
- true if the dataset is empty.
-
get
Returns the instance at the specified index.- Parameters:
i- the index of the instance to be returned.- Returns:
- the i-th instance.
-
apply
Returns the index at the specified index. For Scala's convenience.- Parameters:
i- the index of the instance to be returned.- Returns:
- the i-th instance.
-
stream
Stream<SampleInstance<D,T>> stream()Returns a (possibly parallel) Stream with this collection as its source.- Returns:
- a (possibly parallel) Stream with this collection as its source.
-
batch
Returns an iterator of mini-batches.- Parameters:
size- the batch size.- Returns:
- an iterator of mini-batches.
-
toList
Returns theListof data items.- Returns:
- the
Listof data items.
-
toString
Returns the string representation of the dataset.- Parameters:
numRows- the number of rows to show.- Returns:
- the string representation of the dataset.
-
of
Returns a default implementation of Dataset from a collection.- Type Parameters:
D- the data type.T- the target type.- Parameters:
instances- the sample instances.- Returns:
- the dataset.
-
of
-
of
Returns a default implementation of Dataset from a collection.- Type Parameters:
D- the data type.T- the target type.- Parameters:
data- the sample data.target- the sample targets.- Returns:
- the dataset.
-
of
-
of
-
of
-