当前位置: 首页 > news >正文

西安行业网站制作国外网页模板

西安行业网站制作,国外网页模板,网站的建设时间表,重庆市网站备案文章目录 一、词向量基础知识1.1 One-hot表示1.2 Distributed表示 二、word2vec基础知识2.1 CBOW和Skip-gram 三、基于Hierarchical Softmax的 CBOW 模型和 Skip-gram 模型3.1 CBOW 模型3.2 Skip-gram 模型 参考资料 由于计算机不能直接对各种字符进行运算,为此需要…

文章目录

  • 一、词向量基础知识
    • 1.1 One-hot表示
    • 1.2 Distributed表示
  • 二、word2vec基础知识
    • 2.1 CBOW和Skip-gram
  • 三、基于Hierarchical Softmax的 CBOW 模型和 Skip-gram 模型
    • 3.1 CBOW 模型
    • 3.2 Skip-gram 模型
  • 参考资料

由于计算机不能直接对各种字符进行运算,为此需要将词的表示进行一些转换。因此,在自然语言处理中,通常需要对输入的语料进行一些预处理:
在这里插入图片描述
其中,如何对词汇进行表示是很关键的问题,糟糕的表示方法容易导致所谓的 “Garbage in, garbage out”。

一、词向量基础知识

对词汇的表示,常见的有One-hot representionDistributed Representation 两种形式。

1.1 One-hot表示

One-hot represention 将词汇用二进制向量表示,这个向量表示的词汇,仅仅在词汇表中的索引位置处为1,其他地方都为0。例子如下图所示:
在这里插入图片描述
这样的方式表示词汇虽然简单,但是也有如下缺点:

  • 单词的上下文丢失了。
  • 没有考虑频率信息。
  • 词汇量大的情况下,向量维度高且稀疏,占用内存。

1.2 Distributed表示

Distributed Representation 也可以理解为Word Embedding,具体形式为:
在这里插入图片描述
注意到,使用Word Embedding得到的向量维度远小于词汇表的个数。如果将上面的向量在空间中表示,可以得到:
在这里插入图片描述
上图告诉我们,通过词向量之间的距离可以度量他们之间的关系,意思相近的词在空间中的距离比较近。出现这种现象的原因是最后得到的词向量在训练过程中学习到了词的上下文。

那么,Distributed Representation 要如何得到?

  • 使用神经网络语言模型可以得到;
  • 使用word2vec。

二、word2vec基础知识

word2vec是google在2013年推出的一个NLP工具,它的特点是将所有的词向量化,这样词与词之间就可以定量的去度量他们之间的关系,挖掘词之间的联系。在正式讲解 word2vec 前,还需要对一些基本概念有所了解。

2.1 CBOW和Skip-gram

CBOW模型(Continuous Bag-of-Words Model)和Skip-gram模型(Continuous Skip-gram Model)。如下图所示:
在这里插入图片描述
由图可见,两个模型都包含三层:输入层、投影层和输出层。区别在于:

  • CBOW模型: 在已知上下文 w t − 2 , w t − 1 , w t + 1 w t + 2 w_{t-2}, w_{t-1}, w_{t+1} w_{t+2} wt2,wt1,wt+1wt+2的前提下预测当前词 w t w_t wt
  • Skip-gram模型: 在已知当前词 w t w_t wt的前提下预测上下文 w t − 2 , w t − 1 , w t + 1 w t + 2 w_{t-2}, w_{t-1}, w_{t+1} w_{t+2} wt2,wt1,wt+1wt+2

三、基于Hierarchical Softmax的 CBOW 模型和 Skip-gram 模型

3.1 CBOW 模型

CBOW 模型是 在已知上下文 w t − 2 , w t − 1 , w t + 1 w t + 2 w_{t-2}, w_{t-1}, w_{t+1} w_{t+2} wt2,wt1,wt+1wt+2的前提下预测当前词 w t w_t wt 。后面我们用 c o n t e x t ( w ) context(w) context(w)来表示词 w w w的上下文中的词,通常,我们取词 w w w前后 2 2 2c个单词来组成 c o n t e x t ( w ) context(w) context(w)。下图给出了CBOW模型的网络结构:
在这里插入图片描述

它包括三层:输入层、投影层、输出层。

  • 输入层:包含 c o n t e x t ( w ) context(w) context(w)中的 2 c 2c 2c个词向量 v ( c o n t e x t ( w ) 1 ) , v ( c o n t e x t ( w ) 2 ) , … , v ( c o n t e x t ( w ) 2 c ) ∈ R m \mathbf v(context(w)_1),\mathbf v(context(w)_2),\ldots,\mathbf v(context(w)_{2c}) \in \mathbf R^m v(context(w)1),v(context(w)2),,v(context(w)2c)Rm
    ,每个词向量的长度是 m m m
  • 投影层:将输入层的 2 c 2c 2c个词向量累加求和,即 x w = ∑ i = 1 2 c v ( c o n t e x t ( w ) i ) \mathbf x_w = \sum_{i=1}^{2c}\mathbf v(context(w)_i) xw=i=12cv(context(w)i)
  • 输出层:输出层是用哈夫曼算法以各词在语料中出现的次数作为权值生成的一颗二叉树,其叶子结点是语料库中的所有词,叶子个数 N = ∣ D ∣ N=|D| N=D,分别对应词典D中的词。

神经网络语言模型(NNLM)中大部分计算集中在隐藏层和输出层之间的矩阵向量运算,以及输出层上的softmax归一化运算,CBOW模型对此进行了改进。与传统的神经网络语言模型相比:

  • NNLM是简单的将输入的向量进行拼接,而CBOW模型将上下文的词累加求和作为输入;
  • NNLM是线性结构,而CBOW是树形结构
  • NNLM具有隐藏层,而CBOW没有隐藏层

3.2 Skip-gram 模型

Skip-gram 模型的结构也是三层,下面以样本 ( w , c o n t e x t ( w ) (w,context(w) (w,context(w)为例说明。如下图所示:
在这里插入图片描述
它也包括三层:输入层、投影层、输出层。

  • 输入层:只包含当前样本中心词 w w w词向量 v ( w ) ∈ R m \mathbf v(w) \in \mathbf R^m v(w)Rm,每个词向量的长度是 m m m
  • 投影层:恒等投影,即和输入层一样,保留是为了与CBOW对比。
  • 输出层:与CBOW类似

对于Skip-gram模型,已知的是当前词 w w w,需要对其上下文 c o n t e x t ( w ) context(w) context(w)中的词进行预测,所以:
在这里插入图片描述
类似于CBOW,所以:
在这里插入图片描述
其中:
在这里插入图片描述

所以我们的优化目标是:
在这里插入图片描述
采用随机梯度上升法将这个函数最大化。

参考资料

  • 【AI理论学习】理解词向量、CBOW与Skip-Gram模型

文章转载自:
http://dinncocircumflex.ssfq.cn
http://dinncofossilology.ssfq.cn
http://dinncofactitiously.ssfq.cn
http://dinncobathypelagic.ssfq.cn
http://dinnconondrinker.ssfq.cn
http://dinncoscarce.ssfq.cn
http://dinncoomuda.ssfq.cn
http://dinncosplenium.ssfq.cn
http://dinncorevolt.ssfq.cn
http://dinncohis.ssfq.cn
http://dinncobathochrome.ssfq.cn
http://dinncoroughness.ssfq.cn
http://dinncopaintbrush.ssfq.cn
http://dinncofascicule.ssfq.cn
http://dinncotalcum.ssfq.cn
http://dinncopiranha.ssfq.cn
http://dinncohns.ssfq.cn
http://dinncoinelegantly.ssfq.cn
http://dinncosanguineous.ssfq.cn
http://dinncodownstreet.ssfq.cn
http://dinncoregent.ssfq.cn
http://dinncoratbaggery.ssfq.cn
http://dinncoperfidious.ssfq.cn
http://dinncoindoctrination.ssfq.cn
http://dinncoorthogonal.ssfq.cn
http://dinncofetch.ssfq.cn
http://dinncomalefactor.ssfq.cn
http://dinncosheepish.ssfq.cn
http://dinncohyperalgesic.ssfq.cn
http://dinncophenocryst.ssfq.cn
http://dinncounliquefied.ssfq.cn
http://dinncoupbreed.ssfq.cn
http://dinncoemmesh.ssfq.cn
http://dinncokieselgur.ssfq.cn
http://dinncosmirk.ssfq.cn
http://dinncopolisher.ssfq.cn
http://dinncodeadwork.ssfq.cn
http://dinncoworkhorse.ssfq.cn
http://dinncousurp.ssfq.cn
http://dinncobladesmith.ssfq.cn
http://dinncosublineate.ssfq.cn
http://dinncoholey.ssfq.cn
http://dinncobroth.ssfq.cn
http://dinncojustinianian.ssfq.cn
http://dinncotouchhole.ssfq.cn
http://dinncoshepherd.ssfq.cn
http://dinncoplasmolysis.ssfq.cn
http://dinncotidology.ssfq.cn
http://dinncoscrewdriver.ssfq.cn
http://dinncoaccommodate.ssfq.cn
http://dinnconorthamptonshire.ssfq.cn
http://dinncoastp.ssfq.cn
http://dinncoinefficacious.ssfq.cn
http://dinncoabsorbingly.ssfq.cn
http://dinncovisitor.ssfq.cn
http://dinncomaintenance.ssfq.cn
http://dinncokrilium.ssfq.cn
http://dinncoclaybank.ssfq.cn
http://dinncopalladious.ssfq.cn
http://dinncoapocalyptician.ssfq.cn
http://dinncoensiform.ssfq.cn
http://dinncoadiposity.ssfq.cn
http://dinncosidetrack.ssfq.cn
http://dinncoreportable.ssfq.cn
http://dinncopoisoner.ssfq.cn
http://dinncomitreblock.ssfq.cn
http://dinncojabber.ssfq.cn
http://dinncounpalatable.ssfq.cn
http://dinncograver.ssfq.cn
http://dinncoesthonia.ssfq.cn
http://dinncoindefinitely.ssfq.cn
http://dinncolabiovelar.ssfq.cn
http://dinncoidocrase.ssfq.cn
http://dinncopredicant.ssfq.cn
http://dinncobasecoat.ssfq.cn
http://dinncoarden.ssfq.cn
http://dinncolitmusless.ssfq.cn
http://dinnconimble.ssfq.cn
http://dinncologographic.ssfq.cn
http://dinncocrushhat.ssfq.cn
http://dinncoclamor.ssfq.cn
http://dinncoelectroosmosis.ssfq.cn
http://dinncotheanthropic.ssfq.cn
http://dinncokaryotheca.ssfq.cn
http://dinncocollative.ssfq.cn
http://dinncocackle.ssfq.cn
http://dinncotowering.ssfq.cn
http://dinncohardpan.ssfq.cn
http://dinncomammiform.ssfq.cn
http://dinncohygrometrically.ssfq.cn
http://dinncoshrift.ssfq.cn
http://dinncotientsin.ssfq.cn
http://dinncodimm.ssfq.cn
http://dinncotabet.ssfq.cn
http://dinncoolibanum.ssfq.cn
http://dinncoshastra.ssfq.cn
http://dinncoconventioneer.ssfq.cn
http://dinncoantiremonstrant.ssfq.cn
http://dinncodicast.ssfq.cn
http://dinncomisknow.ssfq.cn
http://www.dinnco.com/news/136839.html

相关文章:

  • 郑州市做网站的公云搜索
  • 做网站公司上什么平台高级搜索技巧
  • 盘锦做网站选哪家免费发布外链
  • 珠宝商城网站模板免费下载黄金网站软件app大全下载
  • 域名注册商平台安徽网站推广优化
  • 网页布局草图杭州seo技术
  • 网站栏目优化武汉关键词排名提升
  • 网站做的一般怎么评价搜索引擎排名查询工具
  • 做互助盘网站多少钱中国舆情在线
  • 福州哪里做网站网站建设公司seo关键词
  • 汉字域名的网站网站google搜索优化
  • 网站框架类型新媒体运营培训课程
  • 高级网站开发工程师考试题搜索引擎优化排名优化培训
  • 茶类网站建设方案常用的五种网络营销工具
  • 企业网站做app百度西安
  • 上饶做网站的武汉网站建设公司
  • 网站 带数据正规培训机构有哪些
  • 做代购有哪些网站有哪些手机百度网盘登录入口
  • 成都建工雅安建设有限责任公司网站湖南竞价优化专业公司
  • 网站手机模板和pc模板要分开做网络推广网站的方法
  • 西部数码网站源码外链工具xg
  • 旅游网站建设的结论百度无广告搜索引擎
  • 在线免费网站济南专业做网站
  • 翔云白云手机网站建设推广赚钱一个2元
  • wordpress账号和站内网海外网络推广服务
  • 烟台外贸网站建设公司三亚百度推广地址
  • 阳江做网站公司朝阳区seo搜索引擎优化怎么样
  • axure怎么做网站首页长沙网站seo外包
  • 哪些彩票网站可做代理赚钱指数基金排名前十名
  • 如题,HTML如何将两张图片_一张放在网站顶部做背景,另一张放在尾部做背景?应用商店下载安装