自然语言处理(七): Deep Learning for NLP: Recurrent Networks

这篇具有很好参考价值的文章主要介绍了自然语言处理(七): Deep Learning for NLP: Recurrent Networks。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

目录

1. N-gram Language Models

2. Recurrent Neural Networks

2.1 RNN Unrolled

2.2 RNN Training

2.3 (Simple) RNN for Language Model

2.4 RNN Language Model: Training

2.5 RNN Language Model: Generation

3. Long Short-term Memory Networks

3.1 Language Model… Solved?

3.2 Long Short-term Memory (LSTM)

3.3 Gating Vector

3.4 Simple RNN vs. LSTM

3.5 LSTM: Forget Gate

3.6 LSTM: Input Gate

3.7 LSTM: Update Memory Cell

3.8 LSTM: Output Gate

3.9 LSTM: Summary

4. Applications

4.1 Shakespeare Generator

4.2 Wikipedia Generator 

4.3 Code Generator 

 4.4 Deep-Speare

4.5 Text Classification

 4.6 Sequence Labeling

4.7 Variants 

4.8 Multi-layer LSTM

4.9 Bidirectional LSTM

5. Final Words


1. N-gram Language Models

- Can be implemented using counts (with smoothing) 可利用计数(经平滑处理)来实施

- Can be implemented using feed-forward neural networks 可以使用前馈神经网络实现

- Generates sentences like (trigram model): 生成类似(三元模型)的句子:

  • I saw a table is round and about
  • I saw a
  • I saw a table
  • I saw a table is
  • I saw a table is round
  • I saw a table is round and

- Problem: limited context

2. Recurrent Neural Networks

Allow representation of arbitrarily sized inputs 允许表示任意大小的输入

Core ldea: processes the input sequence one at a time, by applying a recurrence formula 核心理念: 通过应用递归公式,一次处理一个输入序列

Uses a state vector to represent contexts that have been previously processed 使用状态向量表示以前处理过的上下文

自然语言处理(七): Deep Learning for NLP: Recurrent Networks

自然语言处理(七): Deep Learning for NLP: Recurrent Networks

2.1 RNN Unrolled

自然语言处理(七): Deep Learning for NLP: Recurrent Networks

2.2 RNN Training

自然语言处理(七): Deep Learning for NLP: Recurrent Networks

- An unrolled RNN is just a very deep neural network 一个展开的 RNN 只是一个非常深的神经网络

- But parameters are shared across all time steps 但是参数是在所有时间步骤中共享的

- To train RNN, we just need to create the unrolled computation graph given an input sequence 为了训练 RNN,我们只需要创建一个给定输入序列的展开计算图

- And use backpropagation algorithm to compute gradients as usual 并像往常一样使用反向传播算法计算梯度

- This procedure is called backpropagation through time 这个过程叫做时间反向传播

2.3 (Simple) RNN for Language Model

自然语言处理(七): Deep Learning for NLP: Recurrent Networks

2.4 RNN Language Model: Training

自然语言处理(七): Deep Learning for NLP: Recurrent Networks

2.5 RNN Language Model: Generation

自然语言处理(七): Deep Learning for NLP: Recurrent Networks

3. Long Short-term Memory Networks

3.1 Language Model… Solved?

- RNN has the capability to model infinite context RNN 具有对无限上下文进行建模的能力

- But can it actually capture long-range dependencies in practice? 但是它真的能够在实践中捕获长期依赖吗?

- No… due to “vanishing gradients” 没有,因为“消失的梯度”

- Gradients in later steps diminish quickly during backpropagation 后阶梯度在反向传播过程中迅速减小

- Earlier inputs do not get much update 早期的输入不会得到太多更新

3.2 Long Short-term Memory (LSTM)

- LSTM is introduced to solve vanishing gradients 引入 LSTM 方法解决消失梯度问题

- Core idea: have "memory cells" that preserve gradients across time 核心理念: 拥有“记忆单元”,可以跨时间保持渐变

- Access to the memory cells is controlled by "gates" 进入存储单元是由“门”控制的

- For each input, a gate decides: 

  • how much the new input should be written to the memory cell 应该向存储单元写入多少新输入
  • and how much content of the current memory cell should be forgotten 以及当前内存单元格中有多少内容应该被遗忘

3.3 Gating Vector

- A gate g is a vector 

  • each element has values between 0 to 1

- g is multiplied component-wise with vector v, to determine how much information to keep for v 将 g 与向量 v 按分量相乘,以确定要为 v 保留多少信息

- Use sigmoid function to produce g:

  • values between 0 to 1

自然语言处理(七): Deep Learning for NLP: Recurrent Networks

3.4 Simple RNN vs. LSTM

自然语言处理(七): Deep Learning for NLP: Recurrent Networks

自然语言处理(七): Deep Learning for NLP: Recurrent Networks

3.5 LSTM: Forget Gate

自然语言处理(七): Deep Learning for NLP: Recurrent Networks

3.6 LSTM: Input Gate

自然语言处理(七): Deep Learning for NLP: Recurrent Networks

3.7 LSTM: Update Memory Cell

自然语言处理(七): Deep Learning for NLP: Recurrent Networks

3.8 LSTM: Output Gate

 

自然语言处理(七): Deep Learning for NLP: Recurrent Networks

3.9 LSTM: Summary

自然语言处理(七): Deep Learning for NLP: Recurrent Networks

4. Applications

4.1 Shakespeare Generator

- Training data = all works of Shakespeare

- Model: character RNN, hidden dimension = 512

自然语言处理(七): Deep Learning for NLP: Recurrent Networks

4.2 Wikipedia Generator 

自然语言处理(七): Deep Learning for NLP: Recurrent Networks

Training data = 100MB of Wikipedia raw data

4.3 Code Generator 

自然语言处理(七): Deep Learning for NLP: Recurrent Networks

 4.4 Deep-Speare

 自然语言处理(七): Deep Learning for NLP: Recurrent Networks

4.5 Text Classification

自然语言处理(七): Deep Learning for NLP: Recurrent Networks

 4.6 Sequence Labeling

自然语言处理(七): Deep Learning for NLP: Recurrent Networks

4.7 Variants 

自然语言处理(七): Deep Learning for NLP: Recurrent Networks

4.8 Multi-layer LSTM

自然语言处理(七): Deep Learning for NLP: Recurrent Networks

4.9 Bidirectional LSTM

自然语言处理(七): Deep Learning for NLP: Recurrent Networks

5. Final Words

Pros

- Has the ability to capture long range contexts 有能力捕捉远距离环境

- Just like feedforward networks: flexible 就像前馈网络一样: 灵活

Cons

- Slower than FF networks due to sequential processing 由于顺序处理,比 FF 网络慢

- In practice doesn't capture long range dependency very well (evident when generating very long text) 实际上并不能很好地捕捉到长距离依赖关系(当生成非常长的文本时显而易见)

- In practice also doesn't stack well (multi-layer LSTM) 实际上也不能很好地叠加(多层 LSTM)

- Less popular nowadays due to the emergence of more advanced architectures 现在没那么受欢迎了文章来源地址https://www.toymoban.com/news/detail-412587.html

到了这里,关于自然语言处理(七): Deep Learning for NLP: Recurrent Networks的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 自然语言处理-NLP

    目录 自然语言处理-NLP 致命密码:一场关于语言的较量 自然语言处理的发展历程 兴起时期 符号主义时期 连接主义时期 深度学习时期 自然语言处理技术面临的挑战 语言学角度 同义词问题 情感倾向问题 歧义性问题 对话/篇章等长文本处理问题 探索自然语言理解的本质问题

    2024年02月11日
    浏览(61)
  • 自然语言处理(NLP)

    基础 自然语言处理(NLP) 自然语言处理PaddleNLP-词向量应用展示 自然语言处理(NLP)-前预训练时代的自监督学习 自然语言处理PaddleNLP-预训练语言模型及应用 自然语言处理PaddleNLP-文本语义相似度计算(ERNIE-Gram) 自然语言处理PaddleNLP-词法分析技术及其应用 自然语言处理Pa

    2024年02月08日
    浏览(35)
  • 自然语言处理NLP介绍——NLP简介

    2024年02月15日
    浏览(57)
  • 自然语言处理2-NLP

    目录 自然语言处理2-NLP 如何把词转换为向量 如何让向量具有语义信息 在CBOW中 在Skip-gram中 skip-gram比CBOW效果更好 CBOW和Skip-gram的算法实现 Skip-gram的理想实现 Skip-gram的实际实现 在自然语言处理任务中, 词向量(Word Embedding)是表示自然语言里单词的一种方法 ,即把每个词都表

    2024年02月11日
    浏览(56)
  • 聊聊自然语言处理NLP

    自然语言处理(NLP)的正式定义:是一个使用计算机科学、人工智能(AI)和形式语言学概念来分析自然语言的研究领域。不太正式的定义表明:它是一组工具,用于从自然语言源(如web页面和文本文档)获取有意义和有用的信息。 NLP工具的实现一般是基于机器学习与深度学习、其它

    2024年02月14日
    浏览(53)
  • 自然语言处理(NLP)技术

            自然语言处理技术是一种人工智能技术,它的目标是使计算机能够理解、分析、处理和生成自然语言(人类使用的语言)。NLP技术包括文本分类、情感分析、机器翻译、语音识别、语音合成、信息检索、信息抽取、问答系统等。NLP技术的应用非常广泛,例如智能客

    2024年02月14日
    浏览(46)
  • NLP自然语言处理介绍

    自然语言处理(NLP,Natural Language Processing)是一门涉及计算机与人类语言之间交互的学科。它的目标是使计算机能够理解和生成人类语言,从而更好地处理和解析大量的文本数据。NLP不仅是人工智能领域中一个重要的分支,也是当今社会应用广泛的领域之一。 在NLP中,一个基

    2024年01月21日
    浏览(46)
  • 自然语言处理NLP:一文了解NLP自然语言处理技术,NLP在生活中的应用,图导加深了解,NLP语料库,NLP开源工具

    目录 1.自然语言处理NLP 1.1 NLP中英对照(双份) 1.2 相关文章  2.NLP语料库

    2024年02月09日
    浏览(48)
  • 自然语言处理(NLP) —— 心理语言学

            认知科学和心理语言学是两个密切相关的领域,它们研究 认知过程和语言使用是如何相互作用的。         在历史上,这两个领域的发展经历了几个重要的阶段: 1.1.1 19世纪晚期(内省法)         Wundt 和其他德国心理学家使用一种叫做 内省法 的研究方

    2024年02月21日
    浏览(45)
  • NLP(自然语言处理)是什么?

    NLP基本概念: 自然语言处理( Natural Language Processing, NLP)是以语言为对象,利用计算机技术来分析、理解和处理自然语言的一门学科,即把计算机作为语言研究的强大工具,在计算机的支持下对语言信息进行定量化的研究,并提供可供人与计算机之间能共同使用的语言描写。包括

    2024年02月12日
    浏览(34)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包