Class BaseDataFetcher
- java.lang.Object
-
- org.nd4j.linalg.dataset.api.iterator.fetcher.BaseDataFetcher
-
- All Implemented Interfaces:
Serializable,DataSetFetcher
public abstract class BaseDataFetcher extends Object implements DataSetFetcher
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected DataSetcurrprotected intcursorprotected intinputColumnsprotected static org.slf4j.Loggerlogprotected intnumOutcomesprotected FiletopLevelDirprotected inttotalExamples
-
Constructor Summary
Constructors Constructor Description BaseDataFetcher()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected INDArraycreateInputMatrix(int numRows)Creates a feature vectorprotected INDArraycreateOutputMatrix(int numRows)protected INDArraycreateOutputVector(int outcomeLabel)Creates an output label matrixintcursor()Direct access to a number represenative of iterating through a datasetbooleanhasMore()Whether the dataset has more to loadprotected voidinitializeCurrFromList(List<DataSet> examples)Initializes this data transform fetcher from the passed in datasetsintinputColumns()The length of a feature vector for an individual exampleDataSetnext()Returns the next data applyTransformToDestinationvoidreset()Returns the fetcher back to the beginning of the datasetvoidsetTopLevelDir(File topLevelDir)For file download datasets this sets a top level directory outside the defaultFiletopLevelDir()The top level directory to download datasets from This will usually be the default dl4j resources directory at user home/.deeplearning4jinttotalExamples()The total number of examplesinttotalOutcomes()The number of labels for a dataset-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.nd4j.linalg.dataset.api.iterator.fetcher.DataSetFetcher
fetch
-
-
-
-
Method Detail
-
topLevelDir
public File topLevelDir()
Description copied from interface:DataSetFetcherThe top level directory to download datasets from This will usually be the default dl4j resources directory at user home/.deeplearning4j- Specified by:
topLevelDirin interfaceDataSetFetcher- Returns:
-
setTopLevelDir
public void setTopLevelDir(File topLevelDir)
Description copied from interface:DataSetFetcherFor file download datasets this sets a top level directory outside the default- Specified by:
setTopLevelDirin interfaceDataSetFetcher- Parameters:
topLevelDir- the top level directory to use
-
createInputMatrix
protected INDArray createInputMatrix(int numRows)
Creates a feature vector- Parameters:
numRows- the number of examples- Returns:
- a feature vector
-
createOutputVector
protected INDArray createOutputVector(int outcomeLabel)
Creates an output label matrix- Parameters:
outcomeLabel- the outcome label to use- Returns:
- a binary vector where 1 is transform to the index specified by outcomeLabel
-
createOutputMatrix
protected INDArray createOutputMatrix(int numRows)
-
initializeCurrFromList
protected void initializeCurrFromList(List<DataSet> examples)
Initializes this data transform fetcher from the passed in datasets- Parameters:
examples- the examples to use
-
hasMore
public boolean hasMore()
Description copied from interface:DataSetFetcherWhether the dataset has more to load- Specified by:
hasMorein interfaceDataSetFetcher- Returns:
- whether the data applyTransformToDestination has more to load
-
next
public DataSet next()
Description copied from interface:DataSetFetcherReturns the next data applyTransformToDestination- Specified by:
nextin interfaceDataSetFetcher- Returns:
- the next dataset
-
totalOutcomes
public int totalOutcomes()
Description copied from interface:DataSetFetcherThe number of labels for a dataset- Specified by:
totalOutcomesin interfaceDataSetFetcher- Returns:
- the number of labels for a dataset
-
inputColumns
public int inputColumns()
Description copied from interface:DataSetFetcherThe length of a feature vector for an individual example- Specified by:
inputColumnsin interfaceDataSetFetcher- Returns:
- the length of a feature vector for an individual example
-
totalExamples
public int totalExamples()
Description copied from interface:DataSetFetcherThe total number of examples- Specified by:
totalExamplesin interfaceDataSetFetcher- Returns:
- the total number of examples
-
reset
public void reset()
Description copied from interface:DataSetFetcherReturns the fetcher back to the beginning of the dataset- Specified by:
resetin interfaceDataSetFetcher
-
cursor
public int cursor()
Description copied from interface:DataSetFetcherDirect access to a number represenative of iterating through a dataset- Specified by:
cursorin interfaceDataSetFetcher- Returns:
- a cursor similar to an index
-
-