2387dce2c029356d26d5f394539852343cd726a9,language/nql/dataset.py,,k_hot_array_from_string_list,#Any#Any#Any#,164
Before Change
result = context.zeros_numpy_array(typename, as_matrix=False)
for e in entity_names:
if e:
try:
result += context.one_hot_numpy_array(e, typename, as_matrix=False)
except nql.EntityNameError:
pass
return result
def placeholder_for_type(context,
After Change
// None is not a valid id.
valid_ids = [x for x in ids if x is not None]
max_id = context.get_max_id(typename)
result = np.zeros((max_id,), dtype="float32")
if valid_ids:
result[valid_ids] = 1.
return result
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 4
Instances Project Name: google-research/language
Commit Name: 2387dce2c029356d26d5f394539852343cd726a9
Time: 2019-05-04
Author: no-reply@google.com
File Name: language/nql/dataset.py
Class Name:
Method Name: k_hot_array_from_string_list
Project Name: pymc-devs/pymc3
Commit Name: f565c6fccb4dd503f13f01146d0a6c841c0e13f6
Time: 2016-10-03
Author: becker.mr@gmail.com
File Name: pymc3/diagnostics.py
Class Name:
Method Name: effective_n
Project Name: ikostrikov/pytorch-a2c-ppo-acktr
Commit Name: 4586366c1018257dd448d62f1fc7534e3f5a4338
Time: 2017-11-23
Author: ikostrikov@gmail.com
File Name: enjoy.py
Class Name:
Method Name: