public class SkipGram<T extends SequenceElement> extends Object implements ElementsLearningAlgorithm<T>
| Modifier and Type | Field and Description |
|---|---|
protected ThreadLocal<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 |
protected int |
workers |
| Constructor and Description |
|---|
SkipGram()
Dummy construction is required for reflection
|
| Modifier and Type | Method and Description |
|---|---|
Sequence<T> |
applySubsampling(@NonNull Sequence<T> sequence,
@NonNull AtomicLong nextRandom) |
void |
configure(@NonNull VocabCache<T> vocabCache,
@NonNull WeightLookupTable<T> lookupTable,
@NonNull VectorsConfiguration configuration)
SkipGram initialization over given vocabulary and WeightLookupTable
|
void |
finish() |
List<org.nd4j.linalg.api.ops.aggregates.Aggregate> |
getBatch() |
String |
getCodeName()
Returns implementation code name
|
int |
getWorkers() |
boolean |
isEarlyTerminationHit()
SkipGram has no reasons for early termination ever.
|
double |
iterateSample(List<BatchItem<T>> items) |
double |
iterateSample(T w1,
T lastWord,
AtomicLong nextRandom,
double alpha,
boolean isInference,
org.nd4j.linalg.api.ndarray.INDArray inferenceVector) |
double |
learnSequence(@NonNull Sequence<T> sequence,
@NonNull AtomicLong nextRandom,
double learningRate)
Learns sequence using SkipGram algorithm
|
double |
learnSequence(@NonNull Sequence<T> sequence,
@NonNull AtomicLong nextRandom,
double learningRate,
BatchSequences<T> batchSequences) |
void |
pretrain(SequenceIterator<T> iterator)
SkipGram doesn't involves any pretraining
|
void |
setWorkers(int workers) |
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 int workers
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 ThreadLocal<List<org.nd4j.linalg.api.ops.aggregates.Aggregate>> batches
public int getWorkers()
public void setWorkers(int workers)
public List<org.nd4j.linalg.api.ops.aggregates.Aggregate> getBatch()
public String getCodeName()
getCodeName in interface ElementsLearningAlgorithm<T extends SequenceElement>public void configure(@NonNull
@NonNull VocabCache<T> vocabCache,
@NonNull
@NonNull WeightLookupTable<T> lookupTable,
@NonNull
@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 @NonNull Sequence<T> sequence, @NonNull @NonNull AtomicLong nextRandom)
public double learnSequence(@NonNull
@NonNull Sequence<T> sequence,
@NonNull
@NonNull AtomicLong nextRandom,
double learningRate,
BatchSequences<T> batchSequences)
learnSequence in interface ElementsLearningAlgorithm<T extends SequenceElement>public double learnSequence(@NonNull
@NonNull Sequence<T> sequence,
@NonNull
@NonNull 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>public double iterateSample(T w1, T lastWord, AtomicLong nextRandom, double alpha, boolean isInference, org.nd4j.linalg.api.ndarray.INDArray inferenceVector)
Copyright © 2021. All rights reserved.