convert to multi-hot style :param label_list: e.g.[0,1,4], here 4 means in the 4th position it is true value(as indicate by'1') :param label_size: e.g.199 :return:e.g.[1,1,0,1,0,0,........]
(label_list,label_size)
| 50 | |
| 51 | |
| 52 | def transform_multilabel_as_multihot(label_list,label_size): |
| 53 | """ |
| 54 | convert to multi-hot style |
| 55 | :param label_list: e.g.[0,1,4], here 4 means in the 4th position it is true value(as indicate by'1') |
| 56 | :param label_size: e.g.199 |
| 57 | :return:e.g.[1,1,0,1,0,0,........] |
| 58 | """ |
| 59 | result=np.zeros(label_size) |
| 60 | #set those location as 1, all else place as 0. |
| 61 | result[label_list] = 1 |
| 62 | return result |
| 63 | |
| 64 | #use pretrained word embedding to get word vocabulary and labels, and its relationship with index |
| 65 | def create_vocabulary(training_data_path,vocab_size,name_scope='cnn'): |
no outgoing calls
no test coverage detected