Giter Club home page Giter Club logo

Comments (5)

Coopercoppers avatar Coopercoppers commented on July 29, 2024

这相当于在做笛卡尔积,sta和end的区分是看你concat的先后顺序来定的

from pfn.

WangYao-GoGoGo avatar WangYao-GoGoGo commented on July 29, 2024

前辈请教一下, 上面您说的这种类似笛卡尔积的inference方法是在哪篇论文里面最开始提出来的?
能否给推荐一篇论文,我刚刚入门关系抽取,想学习学习,因为找了半天没找到,而您论文里面对这块也没有详细介绍。 万分谢谢!

from pfn.

WangYao-GoGoGo avatar WangYao-GoGoGo commented on July 29, 2024

我基于您的模型做一些改动,但是在这块给卡住了

from pfn.

kaifangDeng avatar kaifangDeng commented on July 29, 2024

其实头和尾特征还是一样的东西,只不过通过维度扩展对齐了,比如说原来有1,2,3三个字符,通过扩展可以组成全部的组合11,12,13,21,22,。。。,这样就可以对三个字符组成的全部组合分类

from pfn.

WangYao-GoGoGo avatar WangYao-GoGoGo commented on July 29, 2024

@kaifangDeng 谢谢您,这块的特征方法搞明白了。
之前对evaluate里面的关系预测还是有点生疏,今晚又看了一下,理解了一些。谢谢
` def get_trip_pred(self, ner_pred, re_pred):

    ner_mask = torch.sum(ner_pred, dim=1).float()
    ner_mask = torch.sum(ner_mask, dim=-1).float()
    ner_mask = torch.where(ner_mask > 0, torch.ones_like(ner_mask), torch.zeros_like(ner_mask))

    seq_len = ner_mask.size(0)
    e1 = ner_mask.unsqueeze(0).repeat(seq_len, 1, 1)
    e2 = ner_mask.unsqueeze(1).repeat(1, seq_len, 1)
    ner_mask = e1 * e2

    ner_mask = ner_mask.unsqueeze(-1).repeat(1, 1, 1, len(self.rel2idx))
    complete_re_pred = re_pred * ner_mask
    return complete_re_pred`

from pfn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.