public class CBOW<T extends SequenceElement> extends Object implements ElementsLearningAlgorithm<T>
| Modifier and Type | Field and Description |
|---|---|
protected double[] |
expTable |
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 int[] |
variableWindows |
protected int |
window |
| Constructor and Description |
|---|
CBOW() |
| Modifier and Type | Method and Description |
|---|---|
Sequence<T> |
applySubsampling(Sequence<T> sequence,
AtomicLong nextRandom) |
void |
cbow(int i,
List<T> sentence,
int b,
AtomicLong nextRandom,
double alpha,
int currentWindow) |
void |
configure(VocabCache<T> vocabCache,
WeightLookupTable<T> lookupTable,
VectorsConfiguration configuration) |
String |
getCodeName() |
boolean |
isEarlyTerminationHit() |
org.nd4j.linalg.api.ndarray.INDArray |
iterateSample(T currentWord,
org.nd4j.linalg.api.ndarray.INDArray neu1,
AtomicLong nextRandom,
double alpha) |
double |
learnSequence(Sequence<T> sequence,
AtomicLong nextRandom,
double learningRate)
This method does training over the sequence of elements passed into it
|
void |
pretrain(SequenceIterator<T> iterator)
CBOW doesn't involve any pretraining
|
protected static double MAX_EXP
protected int window
protected boolean useAdaGrad
protected double negative
protected double sampling
protected int[] variableWindows
protected double[] expTable
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>public void pretrain(SequenceIterator<T> iterator)
pretrain in interface ElementsLearningAlgorithm<T extends SequenceElement>iterator - public double learnSequence(Sequence<T> sequence, AtomicLong nextRandom, double learningRate)
ElementsLearningAlgorithmlearnSequence in interface ElementsLearningAlgorithm<T extends SequenceElement>public boolean isEarlyTerminationHit()
isEarlyTerminationHit in interface ElementsLearningAlgorithm<T extends SequenceElement>public org.nd4j.linalg.api.ndarray.INDArray iterateSample(T currentWord, org.nd4j.linalg.api.ndarray.INDArray neu1, AtomicLong nextRandom, double alpha)
public void cbow(int i,
List<T> sentence,
int b,
AtomicLong nextRandom,
double alpha,
int currentWindow)
public Sequence<T> applySubsampling(@NonNull Sequence<T> sequence, @NonNull AtomicLong nextRandom)
Copyright © 2016. All Rights Reserved.