我应该使用哪种类型的神经网络来根据某些输入生成段落?

What type of neural network should I be using to generate a paragraph based on some input?

我对神经网络的了解非常基础,但这是我的目标: 给定一组短输入(一个单词字符串和数字)我希望经过训练的网络生成一段与输入数据相关的文本。

我之前曾使用 RNN 进行基本的自然语言生成,但从未基于给定的输入。 (例如,我玩过 https://github.com/karpathy/char-rnn

那里有太多信息,我不确定我应该使用哪种模型或从哪里开始。

我建议您从一些玩具样品开始,例如:

自然文本生成是一项复杂的任务。可以使用 N_gram 方法、RNN 网络(正如您提到的)来完成,您可以通过上面的链接找到如何完成的方式。

这个问题太宽泛,无法用一个单一的答案来回答,但我试图提及一些有助于你继续研究这一领域的事情。

什么是文本生成?

你提到的问题在文献中主要被认为是text-generation。给模型一段文本(例如,一系列字符、单词或段落),模型会尝试完成文本的其余部分。您的模型越好,生成文本的语义句法结构就越好。

文本生成本身是一种Language Modelling problem. Language Modelling is the core problem for many natural language processing (NLP). A trained language model learns the likelihood of occurrence of a word based on the previous sequence of words used in the text. What does it mean? For instance, in the sentence: A cat sits on the ..., the probability that the next word will be mat is larger than to be water. This simple idea is the main intuition behind language modeling. See chapter 4 of this book,用于对此主题进行详尽的解释。

不同类型的语言建模:

提出了多种语言建模方法,主要分为统计神经语言模型。要比较这两种方法,请查看 this 博客 post。

最近,在语言模型的开发中使用神经网络已成为主导方式,因为:

Nonlinear neural network models solve some of the shortcomings of traditional language models: they allow conditioning on increasingly large context sizes with only a linear increase in the number of parameters, they alleviate the need for manually designing backoff orders, and they support generalization across different contexts.

Page 109, Neural Network Methods in Natural Language Processing, 2017.

用于语言建模的不同类型的神经网络:

为语言建模提出的一堆神经网络架构使用:recurrent neural network, feedforward neural network, convolution neural network, etc. which have their own pros and cons. According to here RNN 模型实现的最先进基准。

RNN 之所以称为循环神经网络,是因为它们对序列的每个元素执行相同的任务,而输出取决于之前的计算。考虑 RNN 的另一种方式是它们有一个“记忆”,可以捕获有关到目前为止已计算的信息。访问 here 了解有关 RNN 的更多详细信息。

如何实现文本生成的循环神经网络?

参见 Tensrflow 中的官方示例 here