public class SkipGram<T extends SequenceElement> extends Object implements ElementsLearningAlgorithm<T>
Modifier and Type | Field and Description |
---|---|
protected VectorsConfiguration |
configuration |
protected double[] |
expTable |
protected WeightLookupTable<T> |
lookupTable |
protected static double |
MAX_EXP |
protected double |
negative |
protected double |
sampling |
protected org.nd4j.linalg.api.ndarray.INDArray |
syn0 |
protected org.nd4j.linalg.api.ndarray.INDArray |
syn1 |
protected org.nd4j.linalg.api.ndarray.INDArray |
syn1Neg |
protected org.nd4j.linalg.api.ndarray.INDArray |
table |
protected boolean |
useAdaGrad |
protected VocabCache<T> |
vocabCache |
protected int |
window |
Constructor and Description |
---|
SkipGram()
Dummy construction is required for reflection
|
Modifier and Type | Method and Description |
---|---|
Sequence<T> |
applySubsampling(Sequence<T> sequence,
AtomicLong nextRandom) |
void |
configure(VocabCache<T> vocabCache,
WeightLookupTable<T> lookupTable,
VectorsConfiguration configuration)
SkipGram initialization over given vocabulary and WeightLookupTable
|
String |
getCodeName()
Returns implementation code name
|
boolean |
isEarlyTerminationHit()
SkipGram has no reasons for early termination ever.
|
double |
iterateSample(T w1,
T w2,
AtomicLong nextRandom,
double alpha) |
double |
learnSequence(Sequence<T> sequence,
AtomicLong nextRandom,
double learningRate)
Learns sequence using SkipGram algorithm
|
void |
pretrain(SequenceIterator<T> iterator)
SkipGram doesn't involves any pretraining
|
protected VocabCache<T extends SequenceElement> vocabCache
protected WeightLookupTable<T extends SequenceElement> lookupTable
protected VectorsConfiguration configuration
protected static double MAX_EXP
protected double[] expTable
protected int window
protected boolean useAdaGrad
protected double negative
protected double sampling
protected org.nd4j.linalg.api.ndarray.INDArray syn0
protected org.nd4j.linalg.api.ndarray.INDArray syn1
protected org.nd4j.linalg.api.ndarray.INDArray syn1Neg
protected org.nd4j.linalg.api.ndarray.INDArray table
public String getCodeName()
getCodeName
in interface ElementsLearningAlgorithm<T extends SequenceElement>
public void configure(@NonNull VocabCache<T> vocabCache, @NonNull WeightLookupTable<T> lookupTable, @NonNull VectorsConfiguration configuration)
configure
in interface ElementsLearningAlgorithm<T extends SequenceElement>
vocabCache
- lookupTable
- configuration
- public void pretrain(SequenceIterator<T> iterator)
pretrain
in interface ElementsLearningAlgorithm<T extends SequenceElement>
iterator
- public Sequence<T> applySubsampling(@NonNull Sequence<T> sequence, @NonNull AtomicLong nextRandom)
public double learnSequence(@NonNull Sequence<T> sequence, @NonNull AtomicLong nextRandom, @NonNull double learningRate)
learnSequence
in interface ElementsLearningAlgorithm<T extends SequenceElement>
sequence
- nextRandom
- learningRate
- public boolean isEarlyTerminationHit()
isEarlyTerminationHit
in interface ElementsLearningAlgorithm<T extends SequenceElement>
public double iterateSample(T w1, T w2, AtomicLong nextRandom, double alpha)
Copyright © 2016. All Rights Reserved.