DATATYPE
- the data type which can be returnedpublic class RandomSampleDataSource<DATATYPE> extends IndexedViewDataSource<DATATYPE>
DataSource
provides randomly sampled view over another
DataSource
.Constructor and Description |
---|
RandomSampleDataSource(DataSource<DATATYPE> dataSource,
double proportion)
Construct the view over the given
DataSource such that it has the
given proportion of items from the original. |
RandomSampleDataSource(DataSource<DATATYPE> dataSource,
int requestedSize)
Construct the view over the given
DataSource such that it has
requestedSize items. |
createTemporaryArray, getData, getData, numDimensions, size
getRandomRows, iterator
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public RandomSampleDataSource(DataSource<DATATYPE> dataSource, int requestedSize)
DataSource
such that it has
requestedSize items.dataSource
- the dataSource to samplerequestedSize
- the requested number of rowsIllegalArgumentException
- if the requested size is bigger than the number of rows in
the datasource being sampled, or less than one.public RandomSampleDataSource(DataSource<DATATYPE> dataSource, double proportion)
DataSource
such that it has the
given proportion of items from the original.dataSource
- the dataSource to sampleproportion
- the proportion of rows from the original to include in the
sampleIllegalArgumentException
- if the proportion is less than 0 or bigger than 1.