Giter VIP home page Giter VIP logo

comments_classifier's Introduction

Comments Classifier

此仓库是基于Tensorflow2.3的评论分类任务,使用Word2vec+(TextCNN/TextRCNN)模型,代码支持二分类和多分类,此项目做了个二元的情感分类。

环境

  • python 3.6.7
  • tensorflow==2.3.0
  • gensim==3.8.3
  • jieba==0.42.1
  • sklearn==0.0

其他环境见requirements.txt

数据集

我的另外一个爬虫项目app_comments_spider中爬取

原理

Word2vec

可以参考我的博客文章01-NLP介绍和词向量02-词向量第二部分和词义
也可看博客刘建平Pinard和文章技术干货 | 漫谈Word2vec之skip-gram模型

TextCNN

textcnn

TextRCNN

textrcnn

使用

配置

在config.py中配置好各个参数,文件中有详细参数说明

训练word2vec

在config.py中的mode中改成train_word2vec并运行

# [train_classifier, interactive_predict, train_word2vec]
mode = 'train_word2vec'

训练分类器

训练好word2vec模型后,开始训练分类器,目前项目支持textcnn/textrcnn模型

# [train_classifier, interactive_predict, train_word2vec]
mode = 'train_classifier'
  • textcnn训练结果

train_results_textcnn

  • att-textcnn训练结果

train_results_att-textcnn

  • textrcnn训练结果

train_results_textrcnn

测试

训练好textcnn可以开始测试

# [train_classifier, interactive_predict, train_word2vec]
mode = 'interactive_predict'
  • 交互测试结果

test

参考

comments_classifier's People

Contributors

stanleylsx avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.