public static class Node2Vec.Builder<V extends SequenceElement,E extends java.lang.Number> extends SequenceVectors.Builder<V>
batchSize, configuration, elementsLearningAlgorithm, enableScavenger, existingVectors, hugeModelExpected, iterations, iterator, layerSize, learningRate, learningRateDecayWords, lookupTable, minLearningRate, minWordFrequency, modelUtils, negative, numEpochs, preciseWeightInit, resetModel, sampling, seed, sequenceLearningAlgorithm, STOP, stopWords, trainElementsVectors, trainSequenceVectors, UNK, unknownElement, useAdaGrad, useHierarchicSoftmax, useUnknown, variableWindows, vectorsListeners, vocabCache, window, workers
Constructor and Description |
---|
Builder(GraphWalker<V> walker,
VectorsConfiguration configuration) |
Modifier and Type | Method and Description |
---|---|
Node2Vec<V,E> |
build()
Build SequenceVectors instance with defined settings/options
|
Node2Vec.Builder<V,E> |
elementsLearningAlgorithm(ElementsLearningAlgorithm<V> algorithm)
* Sets specific LearningAlgorithm as Elements Learning Algorithm
|
Node2Vec.Builder<V,E> |
elementsLearningAlgorithm(java.lang.String algoName)
* Sets specific LearningAlgorithm as Elements Learning Algorithm
|
Node2Vec.Builder<V,E> |
enableScavenger(boolean reallyEnable)
This method ebables/disables periodical vocab truncation during construction
Default value: disabled
|
Node2Vec.Builder<V,E> |
epochs(int numEpochs)
This method defines how much iterations should be done over whole training corpus during modelling
|
Node2Vec.Builder<V,E> |
iterate(SequenceIterator<V> iterator)
This method defines SequenceIterator to be used for model building
|
Node2Vec.Builder<V,E> |
iterations(int iterations)
This method defines how much iterations should be done over batched sequences.
|
Node2Vec.Builder<V,E> |
layerSize(int layerSize)
This method defines number of dimensions for outcome vectors.
|
Node2Vec.Builder<V,E> |
learningRate(double learningRate)
This method defines initial learning rate.
|
Node2Vec.Builder<V,E> |
lookupTable(WeightLookupTable<V> lookupTable)
You can pass externally built WeightLookupTable, containing model weights and vocabulary.
|
Node2Vec.Builder<V,E> |
minLearningRate(double minLearningRate)
This method defines minimum learning rate after decay being applied.
|
Node2Vec.Builder<V,E> |
minWordFrequency(int minWordFrequency)
This method defines minimal element frequency for elements found in the training corpus.
|
Node2Vec.Builder<V,E> |
modelUtils(ModelUtils<V> modelUtils)
ModelUtils implementation, that will be used to access model.
|
Node2Vec.Builder<V,E> |
negativeSample(double negative)
This method defines negative sampling value for skip-gram algorithm.
|
protected void |
presetTables()
This method creates new WeightLookupTable
|
Node2Vec.Builder<V,E> |
resetModel(boolean reallyReset)
This method defines, should all model be reset before training.
|
Node2Vec.Builder<V,E> |
sampling(double sampling)
This method defines sub-sampling threshold.
|
Node2Vec.Builder<V,E> |
seed(long randomSeed)
Sets seed for random numbers generator.
|
Node2Vec.Builder<V,E> |
sequenceLearningAlgorithm(SequenceLearningAlgorithm<V> algorithm)
Sets specific LearningAlgorithm as Sequence Learning Algorithm
|
Node2Vec.Builder<V,E> |
sequenceLearningAlgorithm(java.lang.String algoName)
Sets specific LearningAlgorithm as Sequence Learning Algorithm
|
Node2Vec.Builder<V,E> |
setVectorsListeners(java.util.Collection<VectorsListener<V>> vectorsListeners)
This method sets VectorsListeners for this SequenceVectors model
|
Node2Vec.Builder<V,E> |
stopWords(java.util.Collection<V> stopList)
You can provide collection of objects to be ignored, and excluded out of model
Please note: Object labels and hashCode will be used for filtering
|
Node2Vec.Builder<V,E> |
stopWords(java.util.List<java.lang.String> stopList)
You can provide collection of objects to be ignored, and excluded out of model
Please note: Object labels and hashCode will be used for filtering
|
Node2Vec.Builder<V,E> |
trainElementsRepresentation(boolean trainElements) |
Node2Vec.Builder<V,E> |
trainSequencesRepresentation(boolean trainSequences) |
Node2Vec.Builder<V,E> |
unknownElement(V element)
This method allows you to specify SequenceElement that will be used as UNK element, if UNK is used
|
Node2Vec.Builder<V,E> |
useAdaGrad(boolean reallyUse)
This method defines if Adaptive Gradients should be used in calculations
|
protected Node2Vec.Builder<V,E> |
useExistingWordVectors(WordVectors vec)
This method allows you to use pre-built WordVectors model (SkipGram or GloVe) for DBOW sequence learning.
|
Node2Vec.Builder<V,E> |
useHierarchicSoftmax(boolean reallyUse)
Enable/disable hierarchic softmax
|
Node2Vec.Builder<V,E> |
usePreciseWeightInit(boolean reallyUse)
If set to true, initial weights for elements/sequences will be derived from elements themself.
|
Node2Vec.Builder<V,E> |
useUnknown(boolean reallyUse)
This method allows you to specify, if UNK word should be used internally
|
Node2Vec.Builder<V,E> |
useVariableWindow(int... windows)
This method allows to use variable window size.
|
Node2Vec.Builder<V,E> |
vocabCache(VocabCache<V> vocabCache)
You can pass externally built vocabCache object, containing vocabulary
|
Node2Vec.Builder<V,E> |
windowSize(int windowSize)
Sets window size for skip-Gram training
|
Node2Vec.Builder<V,E> |
workers(int numWorkers)
Sets number of worker threads to be used in calculations
|
batchSize
public Builder(@NonNull GraphWalker<V> walker, @NonNull VectorsConfiguration configuration)
protected Node2Vec.Builder<V,E> useExistingWordVectors(@NonNull WordVectors vec)
SequenceVectors.Builder
useExistingWordVectors
in class SequenceVectors.Builder<V extends SequenceElement>
vec
- existing WordVectors modelpublic Node2Vec.Builder<V,E> iterate(@NonNull SequenceIterator<V> iterator)
SequenceVectors.Builder
iterate
in class SequenceVectors.Builder<V extends SequenceElement>
public Node2Vec.Builder<V,E> sequenceLearningAlgorithm(@NonNull java.lang.String algoName)
SequenceVectors.Builder
sequenceLearningAlgorithm
in class SequenceVectors.Builder<V extends SequenceElement>
algoName
- fully qualified class namepublic Node2Vec.Builder<V,E> sequenceLearningAlgorithm(@NonNull SequenceLearningAlgorithm<V> algorithm)
SequenceVectors.Builder
sequenceLearningAlgorithm
in class SequenceVectors.Builder<V extends SequenceElement>
algorithm
- SequenceLearningAlgorithm implementationpublic Node2Vec.Builder<V,E> elementsLearningAlgorithm(@NonNull java.lang.String algoName)
SequenceVectors.Builder
elementsLearningAlgorithm
in class SequenceVectors.Builder<V extends SequenceElement>
algoName
- fully qualified class namepublic Node2Vec.Builder<V,E> elementsLearningAlgorithm(@NonNull ElementsLearningAlgorithm<V> algorithm)
SequenceVectors.Builder
elementsLearningAlgorithm
in class SequenceVectors.Builder<V extends SequenceElement>
algorithm
- ElementsLearningAlgorithm implementationpublic Node2Vec.Builder<V,E> iterations(int iterations)
SequenceVectors.Builder
iterations
in class SequenceVectors.Builder<V extends SequenceElement>
public Node2Vec.Builder<V,E> epochs(int numEpochs)
SequenceVectors.Builder
epochs
in class SequenceVectors.Builder<V extends SequenceElement>
public Node2Vec.Builder<V,E> workers(int numWorkers)
SequenceVectors.Builder
workers
in class SequenceVectors.Builder<V extends SequenceElement>
public Node2Vec.Builder<V,E> useHierarchicSoftmax(boolean reallyUse)
SequenceVectors.Builder
useHierarchicSoftmax
in class SequenceVectors.Builder<V extends SequenceElement>
public Node2Vec.Builder<V,E> useAdaGrad(boolean reallyUse)
SequenceVectors.Builder
useAdaGrad
in class SequenceVectors.Builder<V extends SequenceElement>
public Node2Vec.Builder<V,E> layerSize(int layerSize)
SequenceVectors.Builder
layerSize
in class SequenceVectors.Builder<V extends SequenceElement>
public Node2Vec.Builder<V,E> learningRate(double learningRate)
SequenceVectors.Builder
learningRate
in class SequenceVectors.Builder<V extends SequenceElement>
public Node2Vec.Builder<V,E> minWordFrequency(int minWordFrequency)
SequenceVectors.Builder
minWordFrequency
in class SequenceVectors.Builder<V extends SequenceElement>
public Node2Vec.Builder<V,E> minLearningRate(double minLearningRate)
SequenceVectors.Builder
minLearningRate
in class SequenceVectors.Builder<V extends SequenceElement>
public Node2Vec.Builder<V,E> resetModel(boolean reallyReset)
SequenceVectors.Builder
resetModel
in class SequenceVectors.Builder<V extends SequenceElement>
public Node2Vec.Builder<V,E> vocabCache(@NonNull VocabCache<V> vocabCache)
SequenceVectors.Builder
vocabCache
in class SequenceVectors.Builder<V extends SequenceElement>
public Node2Vec.Builder<V,E> lookupTable(@NonNull WeightLookupTable<V> lookupTable)
SequenceVectors.Builder
lookupTable
in class SequenceVectors.Builder<V extends SequenceElement>
public Node2Vec.Builder<V,E> sampling(double sampling)
SequenceVectors.Builder
sampling
in class SequenceVectors.Builder<V extends SequenceElement>
public Node2Vec.Builder<V,E> negativeSample(double negative)
SequenceVectors.Builder
negativeSample
in class SequenceVectors.Builder<V extends SequenceElement>
public Node2Vec.Builder<V,E> stopWords(@NonNull java.util.List<java.lang.String> stopList)
SequenceVectors.Builder
stopWords
in class SequenceVectors.Builder<V extends SequenceElement>
public Node2Vec.Builder<V,E> trainElementsRepresentation(boolean trainElements)
trainElementsRepresentation
in class SequenceVectors.Builder<V extends SequenceElement>
public Node2Vec.Builder<V,E> trainSequencesRepresentation(boolean trainSequences)
trainSequencesRepresentation
in class SequenceVectors.Builder<V extends SequenceElement>
public Node2Vec.Builder<V,E> stopWords(@NonNull java.util.Collection<V> stopList)
SequenceVectors.Builder
stopWords
in class SequenceVectors.Builder<V extends SequenceElement>
public Node2Vec.Builder<V,E> windowSize(int windowSize)
SequenceVectors.Builder
windowSize
in class SequenceVectors.Builder<V extends SequenceElement>
public Node2Vec.Builder<V,E> seed(long randomSeed)
SequenceVectors.Builder
seed
in class SequenceVectors.Builder<V extends SequenceElement>
public Node2Vec.Builder<V,E> modelUtils(@NonNull ModelUtils<V> modelUtils)
SequenceVectors.Builder
modelUtils
in class SequenceVectors.Builder<V extends SequenceElement>
modelUtils
- model utils to be usedpublic Node2Vec.Builder<V,E> useUnknown(boolean reallyUse)
SequenceVectors.Builder
useUnknown
in class SequenceVectors.Builder<V extends SequenceElement>
public Node2Vec.Builder<V,E> unknownElement(@NonNull V element)
SequenceVectors.Builder
unknownElement
in class SequenceVectors.Builder<V extends SequenceElement>
public Node2Vec.Builder<V,E> useVariableWindow(int... windows)
SequenceVectors.Builder
useVariableWindow
in class SequenceVectors.Builder<V extends SequenceElement>
public Node2Vec.Builder<V,E> usePreciseWeightInit(boolean reallyUse)
SequenceVectors.Builder
usePreciseWeightInit
in class SequenceVectors.Builder<V extends SequenceElement>
protected void presetTables()
SequenceVectors.Builder
presetTables
in class SequenceVectors.Builder<V extends SequenceElement>
public Node2Vec.Builder<V,E> setVectorsListeners(@NonNull java.util.Collection<VectorsListener<V>> vectorsListeners)
SequenceVectors.Builder
setVectorsListeners
in class SequenceVectors.Builder<V extends SequenceElement>
public Node2Vec.Builder<V,E> enableScavenger(boolean reallyEnable)
SequenceVectors.Builder
enableScavenger
in class SequenceVectors.Builder<V extends SequenceElement>
public Node2Vec<V,E> build()
SequenceVectors.Builder
build
in class SequenceVectors.Builder<V extends SequenceElement>