一种使用CNN来提取特征的模型,通过CNN的filter的大小来获得不同的n-gram的信息,模型的结构如下所示:

输入

输入使用word2vec的50维词向量,加上 position embeddingposition embedding 是一句话的每个单词距离两个entity的距离,比如:

In the morning, the <e1>President</e1> traveled to <e2>Detroit</e2>

句子的长度为n,那么对于第i个单词,他的distance就是i-n, 所以distance的范围是 -n + 1 ~ n -1,position embedding是一个 \((2n-1) * m_d\) 的矩阵,\(m_d\)是embedding的维度。一句话中有两个entity,所以每个单词要计算两次distance。最后将word embedding position embedding拼接起来作为模型的输入,输入数据的shape是 \((m_e + 2m_d) * n\), \(m_e\)是embedding的维度, \(m_d\)是 position embedding的维度。

卷积

采用多个卷积核捕获更多的特征。如果卷积核的大小是 w, 那么,会有权重矩阵 \(\mathbf{f}=\left[\mathbf{f}_{1}, \mathbf{f}_{2}, \ldots, \mathbf{f}_{w}\right]\), f是卷积核,\(f_i\)是大小和\(x_i\)一致的weight。

\[s_{i}=g\left(\sum_{j=0}^{w-1} \mathbf{f}_{j+1}^{\top} \mathbf{x}_{j+i}^{\top}+b\right)
\]

模型中会有多个不同大小的卷积核, 每种卷积核最后会经过max pooling,最后得到的向量再输入到linear层中

\[p_{\mathbf{f}}=\max \{\mathbf{s}\}=\max \left\{s_{1}, s_{2}, \ldots s_{n-w+1}\right\}
\]

s是一个大小为w的卷积核在一句话上经过卷积得到的各个位置的score, 池化操作就是找到这句话中的最大的score。往往同样大小的卷积核会有n个,那么这些卷积核的池化结果就是长度为n的张量。也就是输出的size是(batch, n),如果有m种大小不同的卷积核,则把所有卷积核的输出拼到一起。也就是(batch, n * m)

分类

最后接入到全连接层进行分类

关系抽取--Relation Extraction: Perspective from Convolutional Neural Networks的更多相关文章

  1. [转] Understanding Convolutional Neural Networks for NLP

    http://www.wildml.com/2015/11/understanding-convolutional-neural-networks-for-nlp/ 讲CNN以及其在NLP的应用,非常 ...

  2. Understanding Convolutional Neural Networks for NLP

    When we hear about Convolutional Neural Network (CNNs), we typically think of Computer Vision. CNNs ...

  3. 《Deep Feature Extraction and Classification of Hyperspectral Images Based on Convolutional Neural Networks》论文笔记

    论文题目<Deep Feature Extraction and Classification of Hyperspectral Images Based on Convolutional Ne ...

  4. Convolutional Neural Networks卷积神经网络

    转自:http://blog.csdn.net/zouxy09/article/details/8781543 9.5.Convolutional Neural Networks卷积神经网络 卷积神经 ...

  5. Deep learning_CNN_Review:A Survey of the Recent Architectures of Deep Convolutional Neural Networks——2019

    CNN综述文章 的翻译 [2019 CVPR] A Survey of the Recent Architectures of Deep Convolutional Neural Networks 翻 ...

  6. 论文解读二代GCN《Convolutional Neural Networks on Graphs with Fast Localized Spectral Filtering》

    Paper Information Title:Convolutional Neural Networks on Graphs with Fast Localized Spectral Filteri ...

  7. Notes on Convolutional Neural Networks

    这是Jake Bouvrie在2006年写的关于CNN的训练原理,虽然文献老了点,不过对理解经典CNN的训练过程还是很有帮助的.该作者是剑桥的研究认知科学的.翻译如有不对之处,还望告知,我好及时改正, ...

  8. A Beginner's Guide To Understanding Convolutional Neural Networks(转)

    A Beginner's Guide To Understanding Convolutional Neural Networks Introduction Convolutional neural ...

  9. (转)A Beginner's Guide To Understanding Convolutional Neural Networks

    Adit Deshpande CS Undergrad at UCLA ('19) Blog About A Beginner's Guide To Understanding Convolution ...

随机推荐

  1. spring boot 中英文官方文档

    中文文档:http://oopsguy.com/documents/springboot-docs/1.5.4/index.html#boot-features 英文官方文档:https://docs ...

  2. 基于 Apache Hudi 和DBT 构建开放的Lakehouse

    本博客的重点展示如何利用增量数据处理和执行字段级更新来构建一个开放式 Lakehouse. 我们很高兴地宣布,用户现在可以使用 Apache Hudi + dbt 来构建开放Lakehouse. 在深 ...

  3. idea+SpringBoot使用过程中的问题集合

    1.跨域访问外部接口? 使用Nginx代理(详细参见:https://www.cnblogs.com/ZhaoHS/p/16594619.html): 合并部署,统一从后端访问第三方接口(合并部署详见 ...

  4. Docker0网络及原理探究

    个人观点:Docker网络通信在容器编排.集群部署中具有举足轻重的地位,(玩docker不懂docker0那就......玩不透哇)本篇分析Docker网络,并通过启动几个容器来探究Docker网络及 ...

  5. OSI模型 TCP/IP协议

    常见术语 网络相关的术语 1.拓扑:物理拓扑-----体现了设备之间的连接关系 逻辑拓扑----设备之间的通信关系 2.数据载荷:传递的实际信息 3.报文(PDU--协议数据单元) 4.数据头部的作用 ...

  6. docker访问外部https数字证书问题

    一般我们构建的 docker 镜像使用的都是 alpine linux 系统,默认是不带 ca-certificates 根证书的,导致无法识别外部 https 携带的数字证书. 在访问的时候,会抛出 ...

  7. KingbaseES 查询计划剖析

    概述:了解KingbaseES查询计划对于开发人员和数据库管理员来说都是一项关键技能.这可能是优化SQL查询的第一件事,也是验证优化的SQL查询是否确实实现期望结果的方式. 1.KingbaseES数 ...

  8. C语言001--hello world编译详解

    1.编写hello.c程序,并编译运行 book@100ask:~/linux/c01$ cat hello.c -n 1 #include <stdio.h> 2 3 int main( ...

  9. 使用 Elastic 技术栈构建 K8S 全栈监控 -2: 用 Metricbeat 对 Kubernetes 集群进行监控

    文章转载自:https://www.qikqiak.com/post/k8s-monitor-use-elastic-stack-2/ 操作步骤 git clone https://github.co ...

  10. shell脚本中执行source命令不生效的解决办法

    一个shell脚本文件中有一个source命令,使用bash a.sh命令执行后source命令进行验证没有生效. 这是因为在shell脚本中执行source会看到效果,但是shell脚本执行完后再次 ...