public class Glove extends WordVectorsImpl
Modifier and Type | Class and Description |
---|---|
static class |
Glove.Builder |
Modifier and Type | Field and Description |
---|---|
protected Queue<Pair<Integer,List<Pair<VocabWord,VocabWord>>>> |
jobQueue |
static String |
UNK |
layerSize, lookupTable, stopWords, vocab
Constructor and Description |
---|
Glove(VocabCache cache,
SentenceIterator sentenceIterator,
TextVectorizer textVectorizer,
TokenizerFactory tokenizerFactory,
GloveWeightLookupTable lookupTable,
int layerSize,
double learningRate,
double xMax,
int windowSize,
CoOccurrences coOccurrences,
List<String> stopWords,
boolean stem,
int batchSize,
int minWordFrequency,
double maxCount,
int iterations,
boolean symmetric,
org.apache.commons.math3.random.RandomGenerator gen,
boolean shuffle,
long seed,
int numWorkers) |
Modifier and Type | Method and Description |
---|---|
void |
doIteration(int i,
List<Pair<String,String>> pairList,
Counter<Integer> errorPerIteration,
AtomicInteger processed,
AtomicInteger countUp) |
void |
fit() |
CoOccurrences |
getCoOccurrences() |
double |
getCount(String w1,
String w2) |
static Glove |
load(InputStream is,
InputStream biases)
Load a glove model from an input stream.
|
GloveWeightLookupTable |
lookupTable() |
void |
setCoOccurrences(CoOccurrences coOccurrences) |
void |
setLookupTable(GloveWeightLookupTable lookupTable) |
accuracy, getWordVector, getWordVectorMatrix, getWordVectorMatrixNormalized, hasWord, indexOf, setLookupTable, setVocab, similarity, similarWordsInVocabTo, vocab, wordsNearest, wordsNearest, wordsNearestSum, wordsNearestSum
public static final String UNK
public Glove(VocabCache cache, SentenceIterator sentenceIterator, TextVectorizer textVectorizer, TokenizerFactory tokenizerFactory, GloveWeightLookupTable lookupTable, int layerSize, double learningRate, double xMax, int windowSize, CoOccurrences coOccurrences, List<String> stopWords, boolean stem, int batchSize, int minWordFrequency, double maxCount, int iterations, boolean symmetric, org.apache.commons.math3.random.RandomGenerator gen, boolean shuffle, long seed, int numWorkers)
public void fit()
public void doIteration(int i, List<Pair<String,String>> pairList, Counter<Integer> errorPerIteration, AtomicInteger processed, AtomicInteger countUp)
public static Glove load(InputStream is, InputStream biases) throws IOException
is
- the input stream to read from for the weightsbiases
- the bias input streamIOException
- if one occurspublic CoOccurrences getCoOccurrences()
public void setCoOccurrences(CoOccurrences coOccurrences)
public GloveWeightLookupTable lookupTable()
lookupTable
in interface WordVectors
lookupTable
in class WordVectorsImpl
public void setLookupTable(GloveWeightLookupTable lookupTable)
Copyright © 2015. All rights reserved.