我要在python餐馆评论数据集上实现ABSA任务。而且我想使用Sklearn和Keras对Aspect_category进行编码以虚拟(二进制)变量:
0 [RESTAURANT#GENERAL]
1 [SERVICE#GENERAL]
2 [SERVICE#GENERAL]
3 [FOOD#QUALITY,FOOD#STYLE_OPTIONS]
4 [SERVICE#GENERAL]
5 [RESTAURANT#GENERAL]
6 [FOOD#QUALITY]
7 [RESTAURANT#GENERAL]
from keras.utils import to_categorical
label_encoder = LabelEncoder()
integer_category= label_encoder.fit_transform(labeled_df['aspect_category'])
dummy_category = to_categorical(integer_category)
第
行出现错误(参数必须是字符串或数字) integer_category= label_encoder.fit_transform(labeled_df['aspect_category'])
我会很高兴听到您的解决方案。谢谢!