Class BaseDatasetIterator
- java.lang.Object
-
- org.nd4j.linalg.dataset.api.iterator.BaseDatasetIterator
-
- All Implemented Interfaces:
Serializable,Iterator<DataSet>,DataSetIterator
public class BaseDatasetIterator extends Object implements DataSetIterator
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected intbatchprotected DataSetFetcherfetcherprotected intnumExamplesprotected DataSetPreProcessorpreProcessorprotected FiletopLevelDir
-
Constructor Summary
Constructors Constructor Description BaseDatasetIterator(int batch, int numExamples, DataSetFetcher fetcher)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanasyncSupported()Does this DataSetIterator support asynchronous prefetching of multiple DataSet objects? Most DataSetIterators do, but in some cases it may not make sense to wrap this iterator in an iterator that does asynchronous prefetching.intbatch()Batch sizeList<String>getLabels()Get dataset iterator class labels, if any.DataSetPreProcessorgetPreProcessor()Returns preprocessors, if definedbooleanhasNext()intinputColumns()Input columns for the datasetDataSetnext()DataSetnext(int num)Like the standard next method but allows a customizable number of examples returnedvoidremove()voidreset()Resets the iterator back to the beginningbooleanresetSupported()Is resetting supported by this DataSetIterator? Many DataSetIterators do support resetting, but some don'tvoidsetPreProcessor(DataSetPreProcessor preProcessor)Set a pre processorvoidsetTopLevelDir(File topLevelDir)FiletopLevelDir()inttotalOutcomes()The number of labels for the dataset-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining
-
-
-
-
Field Detail
-
batch
protected int batch
-
numExamples
protected int numExamples
-
fetcher
protected DataSetFetcher fetcher
-
preProcessor
protected DataSetPreProcessor preProcessor
-
topLevelDir
protected File topLevelDir
-
-
Constructor Detail
-
BaseDatasetIterator
public BaseDatasetIterator(int batch, int numExamples, DataSetFetcher fetcher)
-
-
Method Detail
-
setTopLevelDir
public void setTopLevelDir(File topLevelDir)
-
topLevelDir
public File topLevelDir()
-
inputColumns
public int inputColumns()
Description copied from interface:DataSetIteratorInput columns for the dataset- Specified by:
inputColumnsin interfaceDataSetIterator- Returns:
-
totalOutcomes
public int totalOutcomes()
Description copied from interface:DataSetIteratorThe number of labels for the dataset- Specified by:
totalOutcomesin interfaceDataSetIterator- Returns:
-
resetSupported
public boolean resetSupported()
Description copied from interface:DataSetIteratorIs resetting supported by this DataSetIterator? Many DataSetIterators do support resetting, but some don't- Specified by:
resetSupportedin interfaceDataSetIterator- Returns:
- true if reset method is supported; false otherwise
-
asyncSupported
public boolean asyncSupported()
Description copied from interface:DataSetIteratorDoes this DataSetIterator support asynchronous prefetching of multiple DataSet objects? Most DataSetIterators do, but in some cases it may not make sense to wrap this iterator in an iterator that does asynchronous prefetching. For example, it would not make sense to use asynchronous prefetching for the following types of iterators: (a) Iterators that store their full contents in memory already (b) Iterators that re-use features/labels arrays (as future next() calls will overwrite past contents) (c) Iterators that already implement some level of asynchronous prefetching (d) Iterators that may return different data depending on when the next() method is called- Specified by:
asyncSupportedin interfaceDataSetIterator- Returns:
- true if asynchronous prefetching from this iterator is OK; false if asynchronous prefetching should not be used with this iterator
-
reset
public void reset()
Description copied from interface:DataSetIteratorResets the iterator back to the beginning- Specified by:
resetin interfaceDataSetIterator
-
batch
public int batch()
Description copied from interface:DataSetIteratorBatch size- Specified by:
batchin interfaceDataSetIterator- Returns:
-
setPreProcessor
public void setPreProcessor(DataSetPreProcessor preProcessor)
Set a pre processor- Specified by:
setPreProcessorin interfaceDataSetIterator- Parameters:
preProcessor- a pre processor to set
-
getPreProcessor
public DataSetPreProcessor getPreProcessor()
Description copied from interface:DataSetIteratorReturns preprocessors, if defined- Specified by:
getPreProcessorin interfaceDataSetIterator- Returns:
-
getLabels
public List<String> getLabels()
Description copied from interface:DataSetIteratorGet dataset iterator class labels, if any. Note that implementations are not required to implement this, and can simply return null- Specified by:
getLabelsin interfaceDataSetIterator
-
next
public DataSet next(int num)
Description copied from interface:DataSetIteratorLike the standard next method but allows a customizable number of examples returned- Specified by:
nextin interfaceDataSetIterator- Parameters:
num- the number of examples- Returns:
- the next data applyTransformToDestination
-
-