Class Huffman
- java.lang.Object
-
- org.deeplearning4j.models.word2vec.Huffman
-
public class Huffman extends Object
Huffman tree builder- Author:
- Adam Gibson
-
-
Field Summary
Fields Modifier and Type Field Description int
MAX_CODE_LENGTH
-
Constructor Summary
Constructors Constructor Description Huffman(Collection<? extends SequenceElement> words)
Huffman(Collection<? extends SequenceElement> words, int CODE_LENGTH)
Builds Huffman tree for collection of SequenceElements, with defined CODE_LENGTH Default CODE_LENGTH is 40
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
applyIndexes(VocabCache<? extends SequenceElement> cache)
This method updates VocabCache and all it's elements with Huffman indexes Please note: it should be the same VocabCache as was used for Huffman tree initializationvoid
build()
-
-
-
Constructor Detail
-
Huffman
public Huffman(Collection<? extends SequenceElement> words)
-
Huffman
public Huffman(Collection<? extends SequenceElement> words, int CODE_LENGTH)
Builds Huffman tree for collection of SequenceElements, with defined CODE_LENGTH Default CODE_LENGTH is 40- Parameters:
words
-CODE_LENGTH
- CODE_LENGTH defines maximum length of code path, and effectively limits vocabulary size.
-
-
Method Detail
-
build
public void build()
-
applyIndexes
public void applyIndexes(VocabCache<? extends SequenceElement> cache)
This method updates VocabCache and all it's elements with Huffman indexes Please note: it should be the same VocabCache as was used for Huffman tree initialization- Parameters:
cache
- VocabCache to be updated.
-
-