Giter Site home page Giter Site logo

Comments (2)

urialon avatar urialon commented on May 27, 2024 1

Hi @hsellik ,
No problem, feel free to ask questions.

Yes! this is similar to the dense layer of code2vec.

  1. The reason for 2d_path is that the path is encoded using a bidirectional LSTM, so we get two output vectors for the path, "forward" and "backwards".

Now, for the question of whether the matrix is ((2d_path+2d_token) × d_hidden) or (d_hidden x (2d_path+2d_token)) - you are right. I think it should be as you say, (d_hidden x (2d_path+2d_token)) (i.e., d_hidden is first).

Thank you for noticing.

  1. Yeah, I agree, it is a bit confusing. v_1 and v_l are indeed the terminals, which come from the limited set of AST nodes. For example, such terminals are often: "NameExpr", "StringExpr", "IntegerExpr". When we write that we "encode" the path, we mean that we use these symbols and the nonterminals between them. I.e., the path does contain the terminal. When we call encode_token, we take the "value" of these terminals, which is a user-defined value. For example, by a "value" I refer to the number 3, which can be the value of a terminal of type IntegerExpr. A possible value of a terminal of type NameExpr can be the value mySqlConnection.

So E^{nodes} contain terminal types like NameExpr and IntExpr, along with nonterminal types like BlockStatement and ForeachStatement.
The other embedding matrix, E^{subtokens}, contains the subtokens "3", "my", "sql" and "connection".

Does that make sense?

  1. Regarding "encoding" and "embedding":

I usually refer to "embedding" as the vectors that are learned for each symbol, the learned vectors themselves; and I usually refer to "encoding" as something that requires some computation to represent. So, encoding a token can be performed by summing its subtoken embeddings.
encoding a path can be performed by LSTM-ing its node type embeddings.

Does that make sense?

Regarding your chart - it looks accurate! But the best is to look at the code. If there is something you can't find in the code feel free to ask and I'll guide you.

from code2seq.

hsellik avatar hsellik commented on May 27, 2024 1

Thank you for the answers! They all make sense. 😄 💥

I do agree, looking at the code is the best source.

Got to finish off those Andrew Ng courses before tackling the full logic behind Code2Seq attention properly. 😅 On the bright side, Code2Vec model and the attention made a lot of sense!

from code2seq.

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.