我正在寻找一种训练这个数据集的方法,所以我用这个代码用 sklearn 进行了尝试
train_x, test_x, train_y, test_y = train_test_split(df[['city','text']], df[['1','2','3','4']], test_size = 0.40, random_state = 21)
count_vect = CountVectorizer(analyzer='word', ngram_range=(2,3), max_features=20000)
count_vect.fit(df['text'])
x_train = count_vect.transform(train_x)
x_test = count_vect.transform(test_x)
classifier = DecisionTreeClassifier()
classifier.fit(x_train, train_y)
但我有这样的错误
ValueError: Number of labels=2348 does not match number of samples=1
实际上我不知道是否可以直接用它的 4 个标签来训练我的数据
饮歌长啸
慕勒3428872
相关分类