9b1e91f5ec37a73ee3db6b0d715b1d87cbad0181,python/baseline/w2v.py,RandomInitVecModel,__init__,#RandomInitVecModel#Any#Any#Any#Any#,258

Before Change


        super(RandomInitVecModel, self).__init__()
        uw = 0.0 if unif_weight is None else unif_weight
        self.vocab = dict()
        self.vocab["<PAD>"] = 0
        self.vocab["<UNK>"] = 1
        self.dsz = dsz
        self.vsz = 2

After Change


        super(RandomInitVecModel, self).__init__()
        uw = 0.0 if unif_weight is None else unif_weight
        self.vocab = dict()
        for i, name in enumerate(Offsets.VALUES):
            self.vocab[name] = i
        self.dsz = dsz
        self.vsz = Offsets.OFFSET

        if counts is True:
            for name in Offsets.VALUES:
                known_vocab.pop(name, 0)
            attested = [v for v, cnt in known_vocab.items() if cnt > 0]
            for k, v in enumerate(attested):
                self.vocab[v] = k + Offsets.OFFSET
                self.vsz += 1
        else:
            self.vocab = known_vocab
            self.vsz = len(self.vocab)

        self.weights = np.random.uniform(-uw, uw, (self.vsz, self.dsz))

        self.nullv = np.zeros(self.dsz, dtype=np.float32)

        self.weights[0] = self.nullv
        for i in range(1, len(Offsets.VALUES)):
            self.weights[i] = np.random.uniform(-uw, uw, self.dsz)

    def get_vocab(self):
        return self.vocab

    def get_dsz(self):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 9

Instances


Project Name: dpressel/mead-baseline
Commit Name: 9b1e91f5ec37a73ee3db6b0d715b1d87cbad0181
Time: 2018-10-23
Author: dpressel@gmail.com
File Name: python/baseline/w2v.py
Class Name: RandomInitVecModel
Method Name: __init__


Project Name: dpressel/mead-baseline
Commit Name: 9b1e91f5ec37a73ee3db6b0d715b1d87cbad0181
Time: 2018-10-23
Author: dpressel@gmail.com
File Name: python/baseline/w2v.py
Class Name: PretrainedEmbeddingsModel
Method Name: __init__


Project Name: has2k1/plotnine
Commit Name: 14538c6714f45c0dbd6c95ff351c272c9cf85701
Time: 2014-04-29
Author: has2k1@gmail.com
File Name: ggplot/stats/stat_density.py
Class Name: stat_density
Method Name: _calculate