1.word2vec和深度学习有什么关系
1、计算机视觉
ImageNet Classification with Deep Convolutional Neural Networks, Alex Krizhevsky, Ilya Sutskever, Geoffrey E Hinton, NIPS 2012.
Learning Hierarchical Features for Scene Labeling, Clement Farabet, Camille Couprie, Laurent Najman and Yann LeCun, IEEE Transactions on Pattern Analysis and Machine Intelligence, 2013.
Learning Convolutional Feature Hierarchies for Visual Recognition, Koray Kavukcuoglu, Pierre Sermanet, Y-Lan Boureau, Karol Gregor, Micha?l Mathieu and Yann LeCun, Advances in Neural Information Processing Systems (NIPS 2010), 23, 2010.
2、语音识别
微软研究人员通过与hintion合作,首先将RBM和DBN引入到语音识别声学模型训练中,并且在大词汇量语音识别系统中获得巨大成功,使得语音识别的错误率相对减低30%。但是,DNN还没有有效的并行快速算法,很多研究机构都是在利用大规模数据语料通过GPU平台提高DNN声学模型的训练效率。
在国际上,IBM、google等公司都快速进行了DNN语音识别的研究,并且速度飞快。
国内方面,阿里巴巴,科大讯飞、百度、中科院自动化所等公司或研究单位,也在进行深度学习在语音识别上的研究。
3、自然语言处理等其他领域
很多机构在开展研究,2013年Tomas Mikolov,Kai Chen,Greg Corrado,Jeffrey Dean发表论文Efficient Estimation of Word Representations in Vector Space建立word2vector模型,与传统的词袋模型(bag of words)相比,word2vector能够更好地表达语法信息。 深度学习在自然语言处理等领域主要应用于机器翻译以及语义挖掘等方面。
2.word2vec 词向量怎么来的
2013年,Google开源了一款用于词向量计算的工具——word2vec,引起了工业界和学术界的关注。首先,word2vec可以在百万数量级的词典和上亿的数据集上进行高效地训练;其次,该工具得到的训练结果——词向量(word embedding),可以很好地度量词与词之间的相似性。随着深度学习(Deep Learning)在自然语言处理中应用的普及,很多人误以为word2vec是一种深度学习算法。其实word2vec算法的背后是一个浅层神经网络。另外需要强调的一点是,word2vec是一个计算word vector的开源工具。当我们在说word2vec算法或模型的时候,其实指的是其背后用于计算word vector的CBoW模型和Skip-gram模型。很多人以为word2vec指的是一个算法或模型,这也是一种谬误。接下来,本文将从统计语言模型出发,尽可能详细地介绍word2vec工具背后的算法模型的来龙去脉。
详情:网页链接
3.如何用python安装woord2vector
gensim 用conda install gensim 与pip install gensim 安装是不同的 提示C编译器会更快,windows下装了 MinGW 中文wiki处理 gensim模块中有专门处理wiki语料的函数 中文分词还是用的jieba 因为wiki百科有繁体,简繁体转换用了 还有最开始程序运行有问题,发现了自己python的一个坏习惯,应该把程序写成函数 [python] view plain copy if __name__ == '__main__': my_function() 这样子python import这个文件就不会发生问题 [python] view plain copy# -*- coding: utf-8 -*- from gensim.corpora import WikiCorpus import jieba from langconv import * _author__ = 'Lust' # read the wiki.xml.bz2 # transform it to simplified Chinese (use langconv) # Chinese text segmentation(use jieba) # save it as txt def my_function(): space = " " i = 0 l = [] a = '..//data//zhwiki-latest-pages-articles.xml.bz2' f = open('..//data//reduce_zhiwiki.txt', 'w') wiki = WikiCorpus(a, lemmatize=False, dictionary={}) # texts = wiki.get_texts() for text in wiki.get_texts(): for temp_sentence in text: temp_sentence = Converter('zh-hans').convert(temp_sentence.decode('utf-8')) temp_sentence = temp_sentence.encode('utf-8') seg_list = list(jieba.cut(temp_sentence)) # for temp_term in temp_sentence: for temp_term in seg_list: l.append(temp_term.encode('utf-8')) f.write(space.join(l) + "\n") l = [] i = i + 1 print "Saved " + str(i) + " articles" # limit number of wikis if (i == 100): break f.close() if __name__ == '__main__': my_function() gensim中的word2vector 超级简单,一个函数的事情。
唯一要注意的是workers=multiprocessing.cpu_count()-4,如果不-4,win10会蓝屏,因为CPU总是100%,把电脑累蓝了?[python] view plain copy# -*- coding: utf-8 -*- from gensim.models import Word2Vec from gensim.models.word2vec import LineSentence import multiprocessing _author__ = 'Lust' # read the txt # word2vec it # save it as model and vector def my_function(): a = open('..//data//zhiwiki_news.txt', 'r') f_1 = open('..//result//zhiwiki_news.model', 'w') f_2 = open('..//result//zhiwiki_news.vector', 'w') model = Word2Vec(LineSentence(a), size=400, window=5, min_count=5, workers=multiprocessing.cpu_count()-4) model.save(f_1) model.save_word2vec_format(f_2, binary=False) if __name__ == '__main__': my_function() 使用训练好的模型 [python] view plain copy# -*- coding: utf-8 -*- import gensim _author__ = 'Lust' # read the news # Chinese text segmentation(use jieba) # add it to zhiwiki_news def my_function(): model = gensim.models.Word2Vec.load_word2vec_format("wiki.en.text.vector", binary=False) model.most_similar("man") model.similarity("woman", "girl") if __name__ == '__main__': my_function()。
4.如何用python安装woord2vector
安装
gensim有一些依赖,首先请先确保你安装了这些东西:
Python >= 2.6. Tested with versions 2.6, 2.7, 3.3, 3.4 and 3.5. Support for Python 2.5 was discontinued starting gensim 0.10.0; if you must use Python 2.5, install gensim 0.9.1.
NumPy >= 1.3. Tested with version 1.9.0, 1.7.1, 1.7.0, 1.6.2, 1.6.1rc2, 1.5.0rc1, 1.4.0, 1.3.0, 1.3.0rc2.
SciPy >= 0.7. Tested with version 0.14.0, 0.12.0, 0.11.0, 0.10.1, 0.9.0, 0.8.0, 0.8.0b1, 0.7.1, 0.7.0.
还有一点特别注意的是,保证你的系统有C的编译器,不然速度会很慢,其实你可以首先编译一下Google官方的C语言版的试试,然后在安装gensim,gensim的word2vector用了官方的代码
根据官网的安装指南,有两种方法可以选择:
使用easy_install 或者pip,注意这两者可能都需要sudo申请更高的权限
easy_install -U gensim
或者(这个相对于官网的,我修改过,实测我的没问题)
pip install --upgrade --ignore-installed six gensim
我使用了第二种方式进行的安装,如果这些依赖没有安装的,可以安装python和相关的工具后,直接使用pip或easy_install安装。
在进行模型训练的时候,如果不安装Cython,无法进行多线程训练,速度很瘦影响,所以接着安装下Cython
pip install cython
转载请注明出处51数据库 » word2vector是软件么
内涵女神苏晴儿爷