faccba193e28ce1b7e532052a14f55101b71a2e5,tests/pretrained_embeds_test.py,PretrainedEmbedsTest,test_assing_pretrained_weights,#PretrainedEmbedsTest#,60

Before Change


        EMBED_DIM = 5
        // Get Vocab to Idx:
        UNK_IDX = 0
        embed_vocab_to_idx = {}
        for word in embeddings_ref.embed_vocab:
            if word in VOCAB:
                embed_vocab_to_idx[word] = VOCAB.index(word)
            else:
                embed_vocab_to_idx[word] = UNK_IDX
        pretrained_embeds = embeddings_ref.initialize_embeddings_weights(
            embed_vocab_to_idx, UNK_IDX, len(VOCAB), EMBED_DIM, EmbedInitStrategy.RANDOM
        )
        assert pretrained_embeds.shape[0] == len(VOCAB)

After Change


        embeddings_ref.load_cached_embeddings(EMBED_CACHED_PATH)
        VOCAB = ["UNK", "aloha", "the"]
        EMBED_DIM = 5
        embed_vocab_to_idx = {tok: i for i, tok in enumerate(VOCAB)}
        pretrained_embeds = embeddings_ref.initialize_embeddings_weights(
            embed_vocab_to_idx, "UNK", EMBED_DIM, EmbedInitStrategy.RANDOM
        )
        assert pretrained_embeds.shape[0] == len(VOCAB)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 11

Instances


Project Name: facebookresearch/pytext
Commit Name: faccba193e28ce1b7e532052a14f55101b71a2e5
Time: 2018-12-18
Author: mikaell@fb.com
File Name: tests/pretrained_embeds_test.py
Class Name: PretrainedEmbedsTest
Method Name: test_assing_pretrained_weights


Project Name: facebookresearch/pytext
Commit Name: faccba193e28ce1b7e532052a14f55101b71a2e5
Time: 2018-12-18
Author: mikaell@fb.com
File Name: tests/pretrained_embeds_test.py
Class Name: PretrainedEmbedsTest
Method Name: test_assing_pretrained_xlu_weights


Project Name: datascienceinc/Skater
Commit Name: 30631c5a179a705125f40b1ec97b8ca67993788b
Time: 2017-04-06
Author: aikramer2@gmail.com
File Name: pyinterpret/core/global_interpretation/partial_dependence.py
Class Name:
Method Name: _compute_pd