Class Word2VecDataSetIterator
- java.lang.Object
-
- org.deeplearning4j.models.word2vec.iterator.Word2VecDataSetIterator
-
- All Implemented Interfaces:
Serializable
,Iterator<org.nd4j.linalg.dataset.DataSet>
,org.nd4j.linalg.dataset.api.iterator.DataSetIterator
public class Word2VecDataSetIterator extends Object implements org.nd4j.linalg.dataset.api.iterator.DataSetIterator
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Word2VecDataSetIterator(Word2Vec vec, LabelAwareSentenceIterator iter, List<String> labels)
Initializes this iterator with homogenization and adding labels and a batch size of 10Word2VecDataSetIterator(Word2Vec vec, LabelAwareSentenceIterator iter, List<String> labels, int batch)
Initializes this iterator with homogenization and adding labelsWord2VecDataSetIterator(Word2Vec vec, LabelAwareSentenceIterator iter, List<String> labels, int batch, boolean homogenization, boolean addLabels)
Allows for customization of all of the params of the iterator
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
asyncSupported()
int
batch()
List<String>
getLabels()
boolean
hasNext()
Returnstrue
if the iteration has more elements.int
inputColumns()
org.nd4j.linalg.dataset.DataSet
next()
Returns the next element in the iteration.org.nd4j.linalg.dataset.DataSet
next(int num)
Like the standard next method but allows a customizable number of examples returnedvoid
remove()
Removes from the underlying collection the last element returned by this iterator (optional operation).void
reset()
boolean
resetSupported()
void
setPreProcessor(org.nd4j.linalg.dataset.api.DataSetPreProcessor preProcessor)
int
totalOutcomes()
-
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.DataSetIterator
getPreProcessor
-
Methods inherited from interface java.util.Iterator
forEachRemaining
-
-
-
-
Constructor Detail
-
Word2VecDataSetIterator
public Word2VecDataSetIterator(Word2Vec vec, LabelAwareSentenceIterator iter, List<String> labels, int batch, boolean homogenization, boolean addLabels)
Allows for customization of all of the params of the iterator- Parameters:
vec
- the word2vec model to useiter
- the sentence iterator to uselabels
- the possible labelsbatch
- the batch sizehomogenization
- whether to homogenize the sentences or notaddLabels
- whether to add labels for windows
-
Word2VecDataSetIterator
public Word2VecDataSetIterator(Word2Vec vec, LabelAwareSentenceIterator iter, List<String> labels)
Initializes this iterator with homogenization and adding labels and a batch size of 10- Parameters:
vec
- the vector model to useiter
- the sentence iterator to uselabels
- the possible labels
-
Word2VecDataSetIterator
public Word2VecDataSetIterator(Word2Vec vec, LabelAwareSentenceIterator iter, List<String> labels, int batch)
Initializes this iterator with homogenization and adding labels- Parameters:
vec
- the vector model to useiter
- the sentence iterator to uselabels
- the possible labelsbatch
- the batch size
-
-
Method Detail
-
next
public org.nd4j.linalg.dataset.DataSet next(int num)
Like the standard next method but allows a customizable number of examples returned- Specified by:
next
in interfaceorg.nd4j.linalg.dataset.api.iterator.DataSetIterator
- Parameters:
num
- the number of examples- Returns:
- the next data applyTransformToDestination
-
inputColumns
public int inputColumns()
- Specified by:
inputColumns
in interfaceorg.nd4j.linalg.dataset.api.iterator.DataSetIterator
-
totalOutcomes
public int totalOutcomes()
- Specified by:
totalOutcomes
in interfaceorg.nd4j.linalg.dataset.api.iterator.DataSetIterator
-
resetSupported
public boolean resetSupported()
- Specified by:
resetSupported
in interfaceorg.nd4j.linalg.dataset.api.iterator.DataSetIterator
-
asyncSupported
public boolean asyncSupported()
- Specified by:
asyncSupported
in interfaceorg.nd4j.linalg.dataset.api.iterator.DataSetIterator
-
reset
public void reset()
- Specified by:
reset
in interfaceorg.nd4j.linalg.dataset.api.iterator.DataSetIterator
-
batch
public int batch()
- Specified by:
batch
in interfaceorg.nd4j.linalg.dataset.api.iterator.DataSetIterator
-
setPreProcessor
public void setPreProcessor(org.nd4j.linalg.dataset.api.DataSetPreProcessor preProcessor)
- Specified by:
setPreProcessor
in interfaceorg.nd4j.linalg.dataset.api.iterator.DataSetIterator
-
getLabels
public List<String> getLabels()
- Specified by:
getLabels
in interfaceorg.nd4j.linalg.dataset.api.iterator.DataSetIterator
-
hasNext
public boolean hasNext()
Returnstrue
if the iteration has more elements. (In other words, returnstrue
ifnext(int)
would return an element rather than throwing an exception.)
-
next
public org.nd4j.linalg.dataset.DataSet next()
Returns the next element in the iteration.
-
remove
public void remove()
Removes from the underlying collection the last element returned by this iterator (optional operation). This method can be called only once per call tonext(int)
. The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method.- Specified by:
remove
in interfaceIterator<org.nd4j.linalg.dataset.DataSet>
- Throws:
UnsupportedOperationException
- if theremove
operation is not supported by this iteratorIllegalStateException
- if thenext
method has not yet been called, or theremove
method has already been called after the last call to thenext
method
-
-