4
$\begingroup$

In my work I have a given source code for a module. From this module I generate an AST, whose size is dependent on the size of the module (e.g. more source code -> bigger AST). I want to train a neural network model which will learn a general structure of a module and be able to rate (on a scale of 0 to 1) how "good" a module is structure wise (if requires are at the beginning, followed by local functions, variables and finally returns). Now I have learnt that Convolutional NNs are quite convenient for this, but the problem I can't seem to solve is that they require a fixed sized input which I can't produce. If I add zero-padding then the outcome will be skewed and the accuracy will suffer. Is there a clear solution to this problem?

$\endgroup$

1 Answer 1

1
$\begingroup$

You discovered already one solution for your problem: Zero-Padding.

There are two other common possibilities:

  1. Using Recurrent NNs
    This is often used at text processing, where you feed each word one after another into your model.
  2. Using Recursive NNs (I wont recommend this for your use case)
    This method is also frequently used in word processing, but is more often applied in the semantic analysis of text. You reduce the text to the essential, until it has reached the desired length. However, information is lost in this process.
$\endgroup$
1
  • $\begingroup$ It would be nice if you can also provide a link to a research work/paper where your suggestions are applied in the context of the original problem. $\endgroup$
    – nbro
    Feb 17, 2020 at 0:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .