MCPcopy Create free account
hub / github.com/brightmart/text_classification / get_label_using_logits

Function get_label_using_logits

a09_DynamicMemoryNet/a8_predict.py:96–103  ·  view source on GitHub ↗
(logits,vocabulary_index2word_label,top_number=5)

Source from the content-addressed store, hash-verified

94
95# get label using logits
96def get_label_using_logits(logits,vocabulary_index2word_label,top_number=5):
97 index_list=np.argsort(logits)[-top_number:] #print("sum_p", np.sum(1.0 / (1 + np.exp(-logits))))
98 index_list=index_list[::-1]
99 label_list=[]
100 for index in index_list:
101 label=vocabulary_index2word_label[index]
102 label_list.append(label) #('get_label_using_logits.label_list:', [u'-3423450385060590478', u'2838091149470021485', u'-3174907002942471215', u'-1812694399780494968', u'6815248286057533876'])
103 return label_list
104
105# get label using logits
106def get_label_using_logits_with_value(logits,vocabulary_index2word_label,top_number=5):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected