Code Monkey home page Code Monkey logo

text-classification's Introduction

text-classification

本代码库包含本人所用情感分类与新闻主题分类模型,模型部署等代码

注意:

1.本案例包含情感分析与新闻主题分类模型,其中其中VKmodel—title.py是text-cnn改进情感分类模型得源码,VKmodel—BIlstm-ATT.py是BILSTM+ATT情感分类模型源码,VKmodel-theme-data.py是主题分类源码,所有模型数据都是从数据库中读取的。

2.情感分析所用数据集数量10万条,使用预训练词向量嵌入的方式进行模型训练,其中BILSTM+attention指标如下图所示:

图1 classreport

我结合text-cnn基础上进行模型改进,模型结果好于BILSTM_ATT结构模型,指标如下图所示:

图2 classreport

模型结构如下图所示,训练过程中模型loss与acc曲线如下所示:

图3.1 loss

图3.2 acc 综上,模型已经排除了过拟合因素影响。 3.新闻主题分类数据总量为40w,使用模型也为基于text-cnn改进模型,模型效果如下图所示,分类为7类,结果待后需进一步优化:

图4 classreport

4.由于github容量大小限制,本代码库删除W2V预训练词向量,本地数据库相关配置项,以及所生成得模型文件。

5.上述所有分类报告皆在经过与训练集,统一数据生成规则得到得测试集所得出,本例还使用了字词联合表征得处理方式进行优化。

6.model_server.py即为模型部署代码,通过flask部署模型文件于应用层,然后通过localhost:5000?context="新闻文本"&&title="新闻标题 "进行部署模型预测即可。

text-classification's People

Contributors

yanhan19940405 avatar

Watchers

 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.