我正在做一个文本分类,我有非常不平衡的数据,比如
Category | Total Records
Cate1 | 950
Cate2 | 40
Cate3 | 10
现在我想对Cate2和Cate3进行过采样,这样它至少有400-500条记录,我更喜欢使用SMOTE而不是随机抽样,代码
^{pr2}$它不起作用,因为它不能生成样本合成文本,现在当我把它转换成类似向量的时候
count_vect = CountVectorizer(analyzer='word', token_pattern=r'\w{1,}')
count_vect.fit(fewRecords['category'])
# transform the training and validation data using count vectorizer object
xtrain_count = count_vect.transform(X_train)
ytrain_train = count_vect.transform(y_train)
当我想在分类后预测真正的类别时,我不确定这是不是正确的方法,以及如何将向量转换为真实文本
首先需要将文本文档转换为固定长度的数字向量,然后执行任何操作。尝试LDA或{a2}。在
相关问题 更多 >
编程相关推荐