赞
踩
NLP之TEA之NB/LoR:基于Rotten Tomatoes影评数据集利用NB(朴素贝叶斯)、LoR(逻辑斯蒂回归)算法(+TfidfVectorizer)实现文本情感分类—五分类预测
目录
NLP之TEA之NB/LoR:基于Rotten Tomatoes影评数据集利用NB(朴素贝叶斯)、LoR(逻辑斯蒂回归)算法(+TfidfVectorizer)实现文本情感分类—五分类预测
NLP之TEA之NB/LoR:基于Rotten Tomatoes影评数据集利用NB(朴素贝叶斯)、LoR(逻辑斯蒂回归)算法(+CountVectorizer)进行文本情感分类—五分类预测
基于Rotten Tomatoes影评数据集利用NB(朴素贝叶斯)、LoR(逻辑斯蒂回归)算法(+TfidfVectorizer)实现文本情感分类—五分类预测
https://yunyaniu.blog.csdn.net/article/details/87707184
https://yunyaniu.blog.csdn.net/article/details/87696356
数据集详见:Dataset之Rotten Tomatoes:Rotten Tomatoes影评数据集简介、下载、使用方法之详细攻略
- tf = TfidfVectorizer(
- analyzer='word',
- ngram_range=(1,4),
- # stop_words=stop_words,
- max_features=150000
- )
-
- x_train,x_test,y_train,y_test = train_test_split(x,y,random_state=1234)
- x_train = tf.transform(x_train)
- x_test = tf.transform(x_test)
-
-
- classifier = MultinomialNB()
- classifier.fit(x_train,y_train)
-
- lg = LogisticRegression(C=4, dual=True)
- lg.fit(x_train,y_train)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。