public class Word2VecDataSetIterator
extends java.lang.Object
implements org.nd4j.linalg.dataset.api.iterator.DataSetIterator
Constructor and Description |
---|
Word2VecDataSetIterator(Word2Vec vec,
LabelAwareSentenceIterator iter,
java.util.List<java.lang.String> labels)
Initializes this iterator with homogenization and adding labels
and a batch size of 10
|
Word2VecDataSetIterator(Word2Vec vec,
LabelAwareSentenceIterator iter,
java.util.List<java.lang.String> labels,
int batch)
Initializes this iterator with homogenization and adding labels
|
Word2VecDataSetIterator(Word2Vec vec,
LabelAwareSentenceIterator iter,
java.util.List<java.lang.String> labels,
int batch,
boolean homogenization,
boolean addLabels)
Allows for customization of all of the params of the iterator
|
Modifier and Type | Method and Description |
---|---|
boolean |
asyncSupported() |
int |
batch() |
int |
cursor() |
java.util.List<java.lang.String> |
getLabels() |
boolean |
hasNext()
Returns
true 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 returned
|
int |
numExamples() |
void |
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 |
totalExamples() |
int |
totalOutcomes() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public Word2VecDataSetIterator(Word2Vec vec, LabelAwareSentenceIterator iter, java.util.List<java.lang.String> labels, int batch, boolean homogenization, boolean addLabels)
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 windowspublic Word2VecDataSetIterator(Word2Vec vec, LabelAwareSentenceIterator iter, java.util.List<java.lang.String> labels)
vec
- the vector model to useiter
- the sentence iterator to uselabels
- the possible labelspublic Word2VecDataSetIterator(Word2Vec vec, LabelAwareSentenceIterator iter, java.util.List<java.lang.String> labels, int batch)
vec
- the vector model to useiter
- the sentence iterator to uselabels
- the possible labelsbatch
- the batch sizepublic org.nd4j.linalg.dataset.DataSet next(int num)
next
in interface org.nd4j.linalg.dataset.api.iterator.DataSetIterator
num
- the number of examplespublic int totalExamples()
totalExamples
in interface org.nd4j.linalg.dataset.api.iterator.DataSetIterator
public int inputColumns()
inputColumns
in interface org.nd4j.linalg.dataset.api.iterator.DataSetIterator
public int totalOutcomes()
totalOutcomes
in interface org.nd4j.linalg.dataset.api.iterator.DataSetIterator
public boolean resetSupported()
resetSupported
in interface org.nd4j.linalg.dataset.api.iterator.DataSetIterator
public boolean asyncSupported()
asyncSupported
in interface org.nd4j.linalg.dataset.api.iterator.DataSetIterator
public void reset()
reset
in interface org.nd4j.linalg.dataset.api.iterator.DataSetIterator
public int batch()
batch
in interface org.nd4j.linalg.dataset.api.iterator.DataSetIterator
public int cursor()
cursor
in interface org.nd4j.linalg.dataset.api.iterator.DataSetIterator
public int numExamples()
numExamples
in interface org.nd4j.linalg.dataset.api.iterator.DataSetIterator
public void setPreProcessor(org.nd4j.linalg.dataset.api.DataSetPreProcessor preProcessor)
setPreProcessor
in interface org.nd4j.linalg.dataset.api.iterator.DataSetIterator
public java.util.List<java.lang.String> getLabels()
getLabels
in interface org.nd4j.linalg.dataset.api.iterator.DataSetIterator
public boolean hasNext()
true
if the iteration has more elements.
(In other words, returns true
if next(int)
would
return an element rather than throwing an exception.)hasNext
in interface java.util.Iterator<org.nd4j.linalg.dataset.DataSet>
true
if the iteration has more elementspublic org.nd4j.linalg.dataset.DataSet next()
next
in interface java.util.Iterator<org.nd4j.linalg.dataset.DataSet>
public void remove()
next(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.remove
in interface java.util.Iterator<org.nd4j.linalg.dataset.DataSet>
java.lang.UnsupportedOperationException
- if the remove
operation is not supported by this iteratorjava.lang.IllegalStateException
- if the next
method has not
yet been called, or the remove
method has already
been called after the last call to the next
method