CNN tensorflow text classification CNN文本分类的例子

from:http://deeplearning.lipingyang.org/tensorflow-examples-text/

TensorFlow examples (text-based)

This page provides links to text-based examples (including code and tutorial for most examples) using TensorFlow.

(Stay tuned, as I keep updating the post while I grow and plow in my deep learning garden:). Also, if you find a dead link, please email me –you can find my email address from the About page, which has a link to my academic website.)

This is a good post. It introduces how to train the model using your own dataset.

To create a useful model you should train it on a large dataset. Ideally, the dataset should be specific for your task. Summarizing news article may be different from summarizing legal documents or job descriptions.

Full example can be found in TensorFlow examples (DNN-based text classification with DBpedia data): https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/learn/text_classification.py (note, that code there will be updated with new APIs so it’s better to check out there).

Another text classification using CNN (CNN-based text classification with DBpedia data):

https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/learn/text_classification_cnn.py

It contains sample code for feeding customized training data set from csv files. It used a simple logistic regression classifier to classify Emails.

Its code on GitHub: Convolutional Neural Network for Text Classification in Tensorflow (python 3)  by dennybritz  on Github (Python 2 version by atveit on Github, this one forked the python 3 version by dennybritz)

Note that python 3 version has more functionality (e.g., eval.py) and it is more up to date.

tf.device("/cpu:0") forces an operation to be executed on the CPU. By default TensorFlow will try to put the operation on the GPU if one is available, but the embedding implementation doesn’t currently have GPU support and throws an error if placed on the GPU.

Johnson, R., & Zhang, T. (2014). Effective use of word order for text categorization with convolutional neural networks. arXiv preprint arXiv:1412.1058.

posted @   bonelee  阅读(1936)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· DeepSeek 开源周回顾「GitHub 热点速览」
历史上的今天:
2017-02-17 shingling算法——提取特征,m个hash函数做指纹计算,针对特征hash后变成m维向量,最后利用union-find算法计算相似性
2017-02-17 普林斯顿算法(1.3)并查集(union-find算法)——本质就是一个数 下面的子树代表了连在一起的点
2017-02-17 Cuckoo hash算法分析——其根本思想和bloom filter一致 增加hash函数来解决碰撞 节省了空间但代价是查找次数增加
2017-02-17 Merkle 树——空间换时间,分而治之的hash表,通过根节点是由它的两个子节点内容的哈希值组成来校验数据完整性,定位篡改的数据位置
2017-02-17 图解Skip List——本质是空间换时间的数据结构,在lucene的倒排列表,bigtable,hbase,cassandra的memtable,redis中sorted set中均用到
2017-02-17 LSM Tree 学习笔记——本质是将随机的写放在内存里形成有序的小memtable,然后定期合并成大的table flush到磁盘
2017-02-17 LSM Tree 学习笔记——MemTable通常用 SkipList 来实现
点击右上角即可分享
微信分享提示