Vocabulary Cache
VocabCache in Deeplearning4j — how vocabulary is stored, InMemoryLookupCache, and vocabulary management
Tokens vs Vocabulary Words
The VocabCache Interface
public interface VocabCache<T extends SequenceElement> extends Serializable {
// Token-level operations
void addToken(T token);
T tokenFor(String word);
boolean hasToken(String word);
Collection<String> words();
// Vocab word operations
void addWordToIndex(int index, String word);
void putVocabWord(String word);
boolean containsWord(String word);
T wordFor(String word);
String wordAtIndex(int index);
int indexOf(String word);
// Frequency and statistics
int docAppearedIn(String word);
void incrementDocCount(String word, long delta);
void setCountForDoc(String word, long count);
long totalWordOccurrences();
double totalNumberOfDocs();
int numWords();
// Inverse document frequency
void incrementTotalDocCount();
double idf(String word);
double documentFrequency(String word);
}InMemoryLookupCache
VocabWord
Field
Meaning
Inspecting the Vocabulary After Training
Vocabulary Size
All Vocabulary Words
Check if a Word Is in Vocabulary
Word Frequency
Word Index
Total Token Occurrences
How minWordFrequency Filters the Vocabulary
TF-IDF and Document Frequency
Manually Adding Tokens and Words
Accessing the VocabCache from a Serialized Model
Further Reading
Last updated
Was this helpful?