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

Function get_label_using_logits

a08_EntityNetwork/a3_predict.py:91–98  ·  view source on GitHub ↗
(logits,vocabulary_index2word_label,top_number=5)

Source from the content-addressed store, hash-verified

89
90# get label using logits
91def get_label_using_logits(logits,vocabulary_index2word_label,top_number=5):
92 index_list=np.argsort(logits)[-top_number:] #print("sum_p", np.sum(1.0 / (1 + np.exp(-logits))))
93 index_list=index_list[::-1]
94 label_list=[]
95 for index in index_list:
96 label=vocabulary_index2word_label[index]
97 label_list.append(label) #('get_label_using_logits.label_list:', [u'-3423450385060590478', u'2838091149470021485', u'-3174907002942471215', u'-1812694399780494968', u'6815248286057533876'])
98 return label_list
99
100# get label using logits
101def 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