Giter VIP home page Giter VIP logo

generative-neural-parser's People

Contributors

cranial-xix avatar kaikulimu avatar timvieira avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

generative-neural-parser's Issues

LSTM-minus implementation

torch.cat( (AAv, BBv, BIv, CIv-BIv), 1 )

I noticed you are using LSTM-minus for the inside span of C, which I' not sure is OK. The minus operation in the NN sometime causes issues which results high weights. (because large weights won't be penalized after minus) Is that possible to just use CIv ?

Some questions[1]

I assume you are using LN.

  1. self.relu = nn.ReLU()
    Any particular reasons for relu? I know it is a popular choice but it won't bound the outputs. This happens to me before where relu is no better than tanh or sigmoid. It might be interesting

  2. B_h1_init = self.initrange(B_in, d_B)
    B_h2_init = self.initrange(d_B, B_out)
    self.B_h1.weight.data.uniform_(-B_h1_init, B_h1_init)
    self.B_h2.weight.data.uniform_(-B_h2_init, B_h2_init)

  3. , what is zeta?
    You're basically implementing Xavier Initialization right? I remember the default init of Pytoch it already that. Is that true?

  4. The implementation here is not a good practice:

    PP = self.nt_emb(Variable(torch.from_numpy(P_P).cuda()))
    PI = torch.index_select(alpha, 0, Variable(torch.from_numpy(P_i).cuda()))
    UA = self.nt_emb(Variable(torch.from_numpy(U_A).cuda()))
    UI = torch.index_select(alpha, 0, Variable(torch.from_numpy(U_i).cuda()))
    BA = self.nt_emb(Variable(torch.from_numpy(B_A).cuda()))
    BI = torch.index_select(alpha, 0, Variable(torch.from_numpy(B_i).cuda()))
    CA = self.nt_emb(Variable(torch.from_numpy(C_A).cuda()))
    CB = self.nt_emb(Variable(torch.from_numpy(C_B).cuda()))
    CI = torch.index_select(alpha, 0, Variable(torch.from_numpy(C_i).cuda()))
    CJ = torch.index_select(alpha, 0, Variable(torch.from_numpy(C_j).cuda()))
    x2y = self.lsm(
    self.B_h2(
    self.relu(
    self.B_h1(
    torch.cat( (BA, BI), 1 )
    )
    )
    )
    ).data.cpu().numpy()
    xy2z = self.lsm(
    self.C_h2(
    self.relu(
    self.C_h1(
    torch.cat( (CA, CB, CI, CJ-CI), 1 )
    )
    )
    )
    ).data.cpu().numpy()
    x2u = self.lsm(
    self.U_h2(
    self.relu(
    self.U_h1(
    torch.cat( (UA, UI), 1 )
    )
    )
    )
    ).data.cpu().numpy()
    lex = self.lsm(
    self.T_h2(
    self.relu(
    self.T_h1(
    torch.cat( (PP, PI), 1 )
    )
    )
    )
    ).data.cpu().numpy()
    else:
    PP = self.nt_emb(Variable(torch.from_numpy(P_P)))
    PI = torch.index_select(alpha, 0, Variable(torch.from_numpy(P_i)))
    UA = self.nt_emb(Variable(torch.from_numpy(U_A)))
    UI = torch.index_select(alpha, 0, Variable(torch.from_numpy(U_i)))
    BA = self.nt_emb(Variable(torch.from_numpy(B_A)))
    BI = torch.index_select(alpha, 0, Variable(torch.from_numpy(B_i)))
    CA = self.nt_emb(Variable(torch.from_numpy(C_A)))
    CB = self.nt_emb(Variable(torch.from_numpy(C_B)))
    CI = torch.index_select(alpha, 0, Variable(torch.from_numpy(C_i)))
    CJ = torch.index_select(alpha, 0, Variable(torch.from_numpy(C_j)))
    x2y = self.lsm(
    self.B_h2(
    self.relu(
    self.B_h1(
    torch.cat( (BA, BI), 1 )
    )
    )
    )
    ).data.numpy()
    xy2z = self.lsm(
    self.C_h2(
    self.relu(
    self.C_h1(
    torch.cat( (CA, CB, CI, CJ-CI), 1 )
    )
    )
    )
    ).data.numpy()
    x2u = self.lsm(
    self.U_h2(
    self.relu(
    self.U_h1(
    torch.cat( (UA, UI), 1 )
    )
    )
    )
    ).data.numpy()
    lex = self.lsm(
    self.T_h2(
    self.relu(
    self.T_h1(
    torch.cat( (PP, PI), 1 )
    )
    )
    )
    ).data.numpy()
    , you might want wrapper of the Variable(..) with pays attention to the device.

  5. How large is self.nnt? If it is large, is that possible to simplify things like.

    self.B_h1(
    torch.cat( (AAv, BIv), 1 )
    )

    ๏ผŸself.nt_emb is a 1-hot embedding. So this is basically concatenating 1 row in the upper part of self.B_h1 with the multiplication output of the lower part.

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.