def Training_model():
#????????????
f = open("f://emotion/mysite/weibo_emotion/emotion_file/data_count.txt") # ???????????
f.readline() # ????
data = np.loadtxt(f)
#?????????
f1 = open("f://emotion/mysite/weibo_emotion/emotion_file/data_jixing.txt")
leibie = np.loadtxt(f1)
f.close()
f1.close()
#TF-IDF??
transformer = TfidfTransformer()
tfidf = transformer.fit_transform(data)
data1 = tfidf.toarray()
#SVM?????
clf = svm.SVC() # class
clf.fit(data1, leibie) # training the svc model
return clf
评论列表
文章目录