public class GloveWeightLookupTable extends InMemoryLookupTable
Modifier and Type | Class and Description |
---|---|
static class |
GloveWeightLookupTable.Builder |
InMemoryLookupTable.WeightIterator
codes, expTable, lr, MAX_EXP, negative, rng, seed, syn0, syn1, syn1Neg, table, useAdaGrad, vectorLength, vocab
Constructor and Description |
---|
GloveWeightLookupTable(VocabCache vocab,
int vectorLength,
boolean useAdaGrad,
double lr,
org.nd4j.linalg.api.rng.Random gen,
double negative,
double xMax,
double maxCount) |
Modifier and Type | Method and Description |
---|---|
org.nd4j.linalg.api.ndarray.INDArray |
getBias() |
org.nd4j.linalg.learning.AdaGrad |
getBiasAdaGrad() |
double |
getMaxCount() |
org.nd4j.linalg.learning.AdaGrad |
getWeightAdaGrad() |
double |
getxMax() |
void |
iterateSample(VocabWord w1,
VocabWord w2,
AtomicLong nextRandom,
double alpha)
Iterate on the given 2 vocab words
|
double |
iterateSample(VocabWord w1,
VocabWord w2,
double score)
glove iteration
|
static GloveWeightLookupTable |
load(InputStream is,
VocabCache vocab)
Load a glove model from an input stream.
|
void |
resetWeights()
Reset the weights of the cache
|
void |
resetWeights(boolean reset)
Clear out all weights regardless
|
void |
setBias(org.nd4j.linalg.api.ndarray.INDArray bias) |
void |
setMaxCount(double maxCount) |
void |
setxMax(double xMax) |
getCodes, getExpTable, getLr, getNegative, getSyn0, getSyn1, getSyn1Neg, getTable, getVectorLength, getVocab, initExpTable, initNegative, isUseAdaGrad, iterate, layerSize, loadCodes, makeTable, plotVocab, plotVocab, putCode, putVector, setCodes, setExpTable, setLearningRate, setLr, setNegative, setSyn0, setSyn1, setSyn1Neg, setTable, setUseAdaGrad, setVectorLength, setVocab, toString, vector, vectors
public GloveWeightLookupTable(VocabCache vocab, int vectorLength, boolean useAdaGrad, double lr, org.nd4j.linalg.api.rng.Random gen, double negative, double xMax, double maxCount)
public void resetWeights(boolean reset)
WeightLookupTable
resetWeights
in interface WeightLookupTable
resetWeights
in class InMemoryLookupTable
public void resetWeights()
resetWeights
in interface WeightLookupTable
resetWeights
in class InMemoryLookupTable
public double iterateSample(VocabWord w1, VocabWord w2, double score)
w1
- the first wordw2
- the second wordscore
- the weight learned for the particular co occurrencespublic org.nd4j.linalg.learning.AdaGrad getWeightAdaGrad()
public org.nd4j.linalg.learning.AdaGrad getBiasAdaGrad()
public static GloveWeightLookupTable load(InputStream is, VocabCache vocab) throws IOException
is
- the input stream to read from for the weightsvocab
- the vocab for the lookuptableIOException
- if one occurspublic void iterateSample(VocabWord w1, VocabWord w2, AtomicLong nextRandom, double alpha)
InMemoryLookupTable
iterateSample
in interface WeightLookupTable
iterateSample
in class InMemoryLookupTable
w1
- the first word to iterate onw2
- the second word to iterate onnextRandom
- next random for samplingalpha
- the alpha to use for learningpublic double getxMax()
public void setxMax(double xMax)
public double getMaxCount()
public void setMaxCount(double maxCount)
public org.nd4j.linalg.api.ndarray.INDArray getBias()
public void setBias(org.nd4j.linalg.api.ndarray.INDArray bias)
Copyright © 2015. All Rights Reserved.