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.

转载于:https://www.cnblogs.com/bonelee/p/8452146.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值