读入数据(JSON):train 为 [[text, label], ...],test 为 ["text1", ...]。
数据清洗:
" ".join(text.split()))。特征工程:
在仅使用 numpy/ pandas / scikit−learn的前提下,完成一个英文短文本情感二分类流程:
1.数据清洗(统一大小写、去掉多余空字符)
2.特征工程:CountVectorizer(1−2gram,mindf=1) → TfidfTransformer
3.模型:LogisticRegression(penalty="12",C=1.0,solver="lbfgs", max_iter=500,random_state=42)
Scan the QR code below with WeChat to sign in
First-time scan will create your account automatically
请使用微信扫描下方二维码完成注册