I am doing a text binary classification problem, the original label has only two values, but after using the build_vocab built in torchtext.data to generate a dictionary, len (label.vocab) is 3. In addition, it is found that everyone in the final fully connected layer of the neural network basically uses out_dim = len (label.vocab). Isn’t this a three-category?
def get_dataset(csv_data, text_field, label_field, test=False):
    # id数据对训练在训练过程中没用，使用None指定其对应的field
    fields = [('request_url',text_field), ('is_malicious',label_field)]     
    examples = []

    if test:
        # 如果为测试集，则不加载label
        for text in tqdm(csv_data['request_url']):
            examples.append(data.Example.fromlist([text, None], fields))
    else:
        for text, label in tqdm(zip(csv_data['request_url'], csv_data['is_malicious'])):
            examples.append(data.Example.fromlist([text, label], fields))
    return examples, fields

text = data.Field(sequential=True, lower=True, tokenize=get3gram)
label = data.Field(sequential=False)
text.tokenize = get3gram
examples, fields = get_dataset(all_data, text, label) #注意更改es_data
    # new_data = data.Dataset(examples, fields=[('request_url',text), ('is_malicious',label)])
train,val = data.Dataset(examples, fields).split()
    # train,val = new_data.split()

text.build_vocab(train, val)
label.build_vocab(train, val)

label_num = len(label.vocab)

#Fully connected layer in cnn
self.linear = nn.Linear(len(filter_sizes)*filter_num, label_num)

It is found by printing that len (label.vocab) = 3, I do n’t understand why, it becomes a three-category, can you manually modify out_dim (the output dimension of the fully connected layer) to 2, will there be no problem in doing so ?