public class Word2VecDataSetIterator extends Object implements DataSetIterator
Constructor and Description |
---|
Word2VecDataSetIterator(Word2Vec vec,
LabelAwareSentenceIterator iter,
List<String> labels)
Initializes this iterator with homogenization and adding labels
and a batch size of 10
|
Word2VecDataSetIterator(Word2Vec vec,
LabelAwareSentenceIterator iter,
List<String> labels,
int batch)
Initializes this iterator with homogenization and adding labels
|
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
|
Modifier and Type | Method and Description |
---|---|
boolean |
asyncSupported()
Does this DataSetIterator support asynchronous prefetching of multiple DataSet objects?
|
int |
batch()
Batch size
|
List<String> |
getLabels()
Get dataset iterator class labels, if any.
|
boolean |
hasNext()
Returns
true if the iteration has more elements. |
int |
inputColumns()
Input columns for the dataset
|
DataSet |
next()
Returns the next element in the iteration.
|
DataSet |
next(int num)
Like the standard next method but allows a
customizable number of examples returned
|
void |
remove()
Removes from the underlying collection the last element returned
by this iterator (optional operation).
|
void |
reset()
Resets the iterator back to the beginning
|
boolean |
resetSupported()
Is resetting supported by this DataSetIterator?
|
void |
setPreProcessor(DataSetPreProcessor preProcessor)
Set a pre processor
|
int |
totalOutcomes()
The number of labels for the dataset
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getPreProcessor
forEachRemaining
public Word2VecDataSetIterator(Word2Vec vec, LabelAwareSentenceIterator iter, List<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, List<String> labels)
vec
- the vector model to useiter
- the sentence iterator to uselabels
- the possible labelspublic Word2VecDataSetIterator(Word2Vec vec, LabelAwareSentenceIterator iter, List<String> labels, int batch)
vec
- the vector model to useiter
- the sentence iterator to uselabels
- the possible labelsbatch
- the batch sizepublic DataSet next(int num)
next
in interface DataSetIterator
num
- the number of examplespublic int inputColumns()
DataSetIterator
inputColumns
in interface DataSetIterator
public int totalOutcomes()
DataSetIterator
totalOutcomes
in interface DataSetIterator
public boolean resetSupported()
DataSetIterator
resetSupported
in interface DataSetIterator
public boolean asyncSupported()
DataSetIterator
asyncSupported
in interface DataSetIterator
public void reset()
DataSetIterator
reset
in interface DataSetIterator
public int batch()
DataSetIterator
batch
in interface DataSetIterator
public void setPreProcessor(DataSetPreProcessor preProcessor)
DataSetIterator
setPreProcessor
in interface DataSetIterator
preProcessor
- a pre processor to setpublic List<String> getLabels()
DataSetIterator
getLabels
in interface 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.)public DataSet next()
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 Iterator<DataSet>
UnsupportedOperationException
- if the remove
operation is not supported by this iteratorIllegalStateException
- if the next
method has not
yet been called, or the remove
method has already
been called after the last call to the next
methodCopyright © 2020. All rights reserved.