0a0688c0fd83165b428d1eafb1b6fb19e1674e29,theanolm/src/theanolm/dictionary.py,WordClass,sample,#WordClass#,71
Before Change
:returns: a random word from this class
return next(iter(self._probs.keys()))
def __init__(self, input_file, input_format):
Creates word classes.
After Change
words = list(self._probs.keys())
probs = list(self._probs.values())
sample_distribution = numpy.random.multinomial(1, probs)
indices = numpy.flatnonzero(sample_distribution)
assert len(indices) == 1
return words[indices[0]]
def __init__(self, input_file, input_format):
Creates word classes.
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 4
Instances
Project Name: senarvi/theanolm
Commit Name: 0a0688c0fd83165b428d1eafb1b6fb19e1674e29
Time: 2015-10-06
Author: seppo.git@marjaniemi.com
File Name: theanolm/src/theanolm/dictionary.py
Class Name: WordClass
Method Name: sample
Project Name: keras-team/keras
Commit Name: 98d49754edd5b5757fb7c37c8a3cdc9a65d6f238
Time: 2015-07-20
Author: michael.d.oliver@gmail.com
File Name: examples/lstm_text_generation.py
Class Name:
Method Name: sample
Project Name: BindsNET/bindsnet
Commit Name: 996804c052aca22d54a5206aab5c6f33552b16f7
Time: 2019-10-05
Author: hi@sharath.pro
File Name: bindsnet/pipeline/action.py
Class Name:
Method Name: select_softmax