jaclearn.embedding package¶
Submodules¶
jaclearn.embedding.constant module¶
jaclearn.embedding.embedding_utils module¶
-
jaclearn.embedding.embedding_utils.init_random(elements_to_embed, embedding_size, add_all_zeros=False, add_unknown=False)[source]¶ Initialize a random embedding matrix for a collection of elements. Elements are sorted in order to ensure the same mapping from indices to elements each time.
Parameters: - elements_to_embed – collection of elements to construct the embedding matrix for
- embedding_size – size of the embedding
- add_all_zeros – add a all_zero embedding at index 0
- add_unknown – add unknown embedding at the last index
Returns: an embedding matrix and a dictionary mapping elements to rows in the matrix
jaclearn.embedding.visualize_tb module¶
jaclearn.embedding.word_embedding module¶
-
jaclearn.embedding.word_embedding.load(path, word_index_only=False, filter=None, format='glove')[source]¶ Loads pre-trained embeddings from the specified path.
-
jaclearn.embedding.word_embedding.load_word_index(path, filter=None, format='glove')[source]¶ Loads only the word index from the embeddings file
@return word to index dictionary