Giter VIP home page Giter VIP logo

besteee / nlp_cls Goto Github PK

View Code? Open in Web Editor NEW

This project forked from linbeyoung/nlp_cls

0.0 0.0 0.0 54.65 MB

本项目主要对各个模型的文本分类能力进行测试,模型包括早期的机器学习模型和目前流行的深度学习。项目中包含数据集的处理和读取方法,相应模型的部分处理代码,以及最后的测试代码。

Shell 0.15% Python 32.21% Jupyter Notebook 67.65%

nlp_cls's Introduction

项目简介

本项目主要对各个模型的文本分类能力进行测试,模型包括早期的机器学习模型和目前流行的深度学习。项目中包含数据集的处理和读取方法,相应模型的部分处理代码,以及最后的测试代码。

模型 代码
朴素贝叶斯 朴素贝叶斯.py
MLP MLP.ipynb
Bert BERT.ipynb
XLNet run_classifier.py
TextRNN, TextCNN, TextRCNN TextRNN, TextCNN, TextRCNN/*.

数据集读取

用法:

from utils.data_loader import load_data

train,test=load_data('./小组作业-语料/') # 输入存放数据集的文件夹即可读取数据集,数据集已经过shuffle

格式:

[
    ["**将军团8年来首访日本 日方希望加强和**沟通",1],
    ["他一张脸都皱紧了",4],
]

结果评测

用法:

from utils.score import score

score(label_truth,label_predict,output_filename='mlp.txt')
# label_truth和label_predict均为整数list
# output_filename参数可选

示例:

label_truth=[1,2,3,5,1,2,3,5,1,2,3,5,1,2,3,5]
label_predict=[2,5,5,5,3,2,3,1,1,2,1,5,1,3,3,5]

score(label_truth,label_predict,output_filename='mlp.txt')

image-20210611162540873

image-20210611162613403

nlp_cls's People

Contributors

linbeyoung avatar hausofliufeng avatar iuanmei 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.