原文的出错地方为:
return {train_label: random.sample(sentences, nc) for train_label, sentences in train_label_to_sentences.items()}
出错的地方是 random.sample(sentences, nc) ,就是sentence中可能没有nc个句子以供随机选择。
自己选取的数据集是一个高度不平衡的数据集,有的类别含有的训练数量只有个位数。
原文的出错地方为:
return {train_label: random.sample(sentences, nc) for train_label, sentences in train_label_to_sentences.items()}
出错的地方是 random.sample(sentences, nc) ,就是sentence中可能没有nc个句子以供随机选择。
自己选取的数据集是一个高度不平衡的数据集,有的类别含有的训练数量只有个位数。