public class SkipGram<T extends SequenceElement> extends java.lang.Object implements ElementsLearningAlgorithm<T>
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.ThreadLocal<java.util.List<org.nd4j.linalg.api.ops.aggregates.Aggregate>> |
batches |
protected VectorsConfiguration |
configuration |
protected org.nd4j.linalg.util.DeviceLocalNDArray |
expTable |
protected WeightLookupTable<T> |
lookupTable |
protected double |
negative |
protected double |
sampling |
protected org.nd4j.linalg.util.DeviceLocalNDArray |
syn0 |
protected org.nd4j.linalg.util.DeviceLocalNDArray |
syn1 |
protected org.nd4j.linalg.util.DeviceLocalNDArray |
syn1Neg |
protected org.nd4j.linalg.util.DeviceLocalNDArray |
table |
protected boolean |
useAdaGrad |
protected int[] |
variableWindows |
protected int |
vectorLength |
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,
java.util.concurrent.atomic.AtomicLong nextRandom) |
void |
configure(VocabCache<T> vocabCache,
WeightLookupTable<T> lookupTable,
VectorsConfiguration configuration)
SkipGram initialization over given vocabulary and WeightLookupTable
|
void |
finish() |
java.util.List<org.nd4j.linalg.api.ops.aggregates.Aggregate> |
getBatch() |
java.lang.String |
getCodeName()
Returns implementation code name
|
boolean |
isEarlyTerminationHit()
SkipGram has no reasons for early termination ever.
|
double |
iterateSample(T w1,
T lastWord,
java.util.concurrent.atomic.AtomicLong nextRandom,
double alpha,
boolean isInference,
org.nd4j.linalg.api.ndarray.INDArray inferenceVector) |
double |
learnSequence(Sequence<T> sequence,
java.util.concurrent.atomic.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 int window
protected boolean useAdaGrad
protected double negative
protected double sampling
protected int[] variableWindows
protected int vectorLength
protected org.nd4j.linalg.util.DeviceLocalNDArray syn0
protected org.nd4j.linalg.util.DeviceLocalNDArray syn1
protected org.nd4j.linalg.util.DeviceLocalNDArray syn1Neg
protected org.nd4j.linalg.util.DeviceLocalNDArray table
protected org.nd4j.linalg.util.DeviceLocalNDArray expTable
protected java.lang.ThreadLocal<java.util.List<org.nd4j.linalg.api.ops.aggregates.Aggregate>> batches
public java.util.List<org.nd4j.linalg.api.ops.aggregates.Aggregate> getBatch()
public java.lang.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 java.util.concurrent.atomic.AtomicLong nextRandom)
public double learnSequence(@NonNull
Sequence<T> sequence,
@NonNull
java.util.concurrent.atomic.AtomicLong nextRandom,
double learningRate)
learnSequence in interface ElementsLearningAlgorithm<T extends SequenceElement>sequence - nextRandom - learningRate - public void finish()
finish in interface ElementsLearningAlgorithm<T extends SequenceElement>public boolean isEarlyTerminationHit()
isEarlyTerminationHit in interface ElementsLearningAlgorithm<T extends SequenceElement>