Kaggle情感分析(Bag of Words Meets Bags of Popcorn)
2016-01-08 14:29
453 查看
Kaggle上有两个情感分析的任务,这是其中的一个Bag of Words Meets Bags of Popcorn。任务虽然已经结束了,但是还有点研究的意义。
https://www.kaggle.com/c/word2vec-nlp-tutorial/data
这是一个炫耀Word2vec能力的竞赛,但是偏偏有人就是不用word2vec。
这个Blog写了用简单的TDF 作为Feature,然后用简单的M-Bayesian方法来进行分类。http://nbviewer.ipython.org/github/jmsteinw/Notebooks/blob/master/NLP_Movies.ipynb
(‘Train ‘, 0.31977043441405351, ‘Valid ‘, 0.40485674490569001)
best Train 0.500157513046 best Test 0.504475696675
完全是random的。
实现这个模型。也使用Word2vec来Initial Embedding。
(‘Train ‘, 0.0, ‘Valid ‘, 0.10599999999999998)
best Train 0.0 best Test 0.104
The code run for 100 epochs, with 79.829817 sec/epochs
Training took 7983.0s
precision recall f1-score support
avg / total 0.90 0.90 0.90 5000
(‘Train ‘, 0.35430654320040156, ‘Valid ‘, 0.39911492640815416)
Seen 20000 samples
best Train 0.32228788388 best Test 0.340027012211
The code run for 200 epochs, with 160.020890 sec/epochs
Training took 32004.2s
precision recall f1-score support
avg / total 0.71 0.57 0.49 5000
(‘Train ‘, 0.36674888341365341, ‘Valid ‘, 0.41000973615537728)
Seen 19997 samples
best Train 0.298261539235 best Test 0.343271244447
The code run for 200 epochs, with 152.172339 sec/epochs
Training took 30434.5s
precision recall f1-score support
avg / total 0.70 0.57 0.50 5000
https://www.kaggle.com/c/word2vec-nlp-tutorial/data
这是一个炫耀Word2vec能力的竞赛,但是偏偏有人就是不用word2vec。
这个Blog写了用简单的TDF 作为Feature,然后用简单的M-Bayesian方法来进行分类。http://nbviewer.ipython.org/github/jmsteinw/Notebooks/blob/master/NLP_Movies.ipynb
1 测试加载数据
test1.py基本拷贝了该Blog的代码,20个CrossValidation的正确率是0.949631168。
2 写一个基于LSTM的模型
将文章转换为一个word sequence,然后将每个word映射为一个向量,在上面直接用LSTM来做Classification。1_mr_lstm.py只是用LSTM最后一个的输出:
(‘Train ‘, 0.31977043441405351, ‘Valid ‘, 0.40485674490569001)
2_mr_lstm.py用LSTM输出sequence的mean:
best Train 0.500157513046 best Test 0.504475696675
完全是random的。
3 看一篇文章使用CNN的
现在的模型和该文的区别就是没有用Word2vec来Training。实现这个模型。也使用Word2vec来Initial Embedding。
5_mr_cnn.py明显Overfit
(‘Train ‘, 0.0, ‘Valid ‘, 0.10599999999999998)
best Train 0.0 best Test 0.104
The code run for 100 epochs, with 79.829817 sec/epochs
Training took 7983.0s
precision recall f1-score support
0 0.90 0.88 0.89 2483 1 0.89 0.91 0.90 2517
avg / total 0.90 0.90 0.90 5000
6_mr_cnn.py加入dropout
4 使用Word2Vec来Pretrain
3_mr_lstm.py用最后的一个输出
(‘Train ‘, 0.35430654320040156, ‘Valid ‘, 0.39911492640815416)
Seen 20000 samples
best Train 0.32228788388 best Test 0.340027012211
The code run for 200 epochs, with 160.020890 sec/epochs
Training took 32004.2s
precision recall f1-score support
0 0.54 0.98 0.69 2483 1 0.88 0.17 0.29 2517
avg / total 0.71 0.57 0.49 5000
4_mr_lstm.py用LSTM输出sequence的mean:
(‘Train ‘, 0.36674888341365341, ‘Valid ‘, 0.41000973615537728)
Seen 19997 samples
best Train 0.298261539235 best Test 0.343271244447
The code run for 200 epochs, with 152.172339 sec/epochs
Training took 30434.5s
precision recall f1-score support
0 0.54 0.97 0.69 2483 1 0.85 0.18 0.30 2517
avg / total 0.70 0.57 0.50 5000
相关文章推荐
- centos7.2 yum 安装tomcat的问题
- bash脚本编程之四,整数测试以及特殊变量
- 网站地址收藏
- 网站漏洞——越权大法,纯文字,不喜勿看
- linux信号量
- 盘点OpenStack2015大事记
- linux常用小技巧三
- 阿里云部署django Ubuntu 12.04.5 + Apache2.2 + django1.8
- 通过编写Shell、Python脚本来实现在线管理KVM虚拟机
- Linux 查看线程占用情况
- OpenMesh学习笔记4 迭代器和循环器
- Linux中errno使用
- Deepin系统扩展分辨率
- linux常用小技巧二
- tomcat配置文件server.xml详解
- linux 通过命令行在后台启动程序。当命令行窗体关闭时,程序不会被关闭
- linux中字符串转换函数 simple_strtoul
- 一步一步安装hadoop1.2.1
- Linux环境下apache性能测试工具ab使用详解
- linux获取daemon进程的控制台数据