• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

dcnn-nlp: An implementation of ACL2014 paper "A Convolutional Neural Networ ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

dcnn-nlp

开源软件地址:

https://gitee.com/linius/dcnn-nlp

开源软件介绍:

#dcnn-nlp (In development)

dcnn-nlp是一款使用卷积神经网络进行自然语言处理以及文本分类的工具。参考2014ACL论文"A Convolutional Neural Network for Modelling Sentences"实现并扩展。

它具有以下特征:

  • 相对于传统的bag of words模型,能更好地利用词语之间的序列信息,因此能更好地捕获短文本的语义
  • 针对不同的文本分类任务不需要做任何特征提取的工作就可以达到State of the Art的效果
  • 使用Python代码编写,核心部分用Cython, BLAS等技术进行大量优化
  • 扩展了论文"A Convolutional Neural Network for Modelling Sentences"中的网络结构,可自由定义深层卷积神经网络层次
  • 改进了论文中词向量的训练方法,支持gensim word2vec工具包
  • 支持无监督训练词语、句子、段落向量(TODO)
  • 支持GPU加速(TODO)

Examples

# Stanford Sentiment Treebank Experiment# You should run python prepare.py in the data/stanford direction firstlytotal_data_file = 'data/stanford/total.data'total_sentences = LineSentence(total_data_file, repeat=5)train_data_file = 'data/stanford/train2.data'train_label_file = 'data/stanford/train2.label'train_sentences = LineSentence(train_data_file)train_labels = numpy.fromfile(train_label_file, sep='\n', dtype=numpy.int32)dev_data_file = 'data/stanford/dev2.data'dev_label_file = 'data/stanford/dev2.label'dev_sentences = LineSentence(dev_data_file)dev_labels = numpy.fromfile(dev_label_file, sep='\n', dtype=numpy.int32)test_data_file = 'data/stanford/test2.data'test_label_file = 'data/stanford/test2.label'test_sentences = LineSentence(test_data_file)test_labels = numpy.fromfile(test_label_file, sep='\n', dtype=numpy.int32)# n_filters=[6,14] in the paper# n_filters=[4,6] in LeNet# But you can go deepermodel = DCNNDeep(sentences=train_sentences, output_layer_size=2, wordvec_dim=48,                  alpha=0.012, entropy_descent_m=0.995, dropout_rate_in_hiddens=0.5,                  dropout_rate_in_input=0.2, min_count=2, full_con_layer_size=5,                  filter_width=[7,5,3], k_top=4, n_filters=[6,14,6], alpha_m=0.999995,                  min_alpha=0.00001, pre_train_word_vec=True, pre_train_sentences=total_sentences)model.train(train_sentences=train_sentences, train_labels=train_labels, patience=5,             validate_freq=2000, max_entropy_allowed=0.38, validate_sentences=dev_sentences,             validate_labels=dev_labels, chunksize=5)print 'test accuracy: %f' %model.accuracy(test_sentences, test_labels)

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap