Re:Code2vec: learning distributed representations of code
by namibj on Wednesday December 05, 2018 @12:34AM
(#18605896)
Well, than maybe train it on random AST equivalency transformations?
I'd assume that to work better.
Re:Code2vec: learning distributed representations of code
by yahave on Wednesday December 05, 2018 @12:37AM
(#18605911)
Yes, that indeed works better
Re:Code2vec: learning distributed representations of code
by Karlozkiller on Wednesday December 05, 2018 @02:49AM
(#18606395)
If the task you want to solve is automatic function naming I definitely think normalizing would be an improvement. But I'm not sure it would be the right thing for all applications. Don't have any examples though.
Re:Code2vec: learning distributed representations of code
by ychen306 on Wednesday December 05, 2018 @01:31AM
(#18606119)
Assuming I understand their approach correctly, they are using little (one could argue none at all) semantic information.
Re:Code2vec: learning distributed representations of code
by faizshah on Wednesday December 05, 2018 @12:58AM
(#18605990)
I wonder if this could be used to help detect plagiarism when auto grading CS homework.
Re:Code2vec: learning distributed representations of code
by toolslive on Wednesday December 05, 2018 @02:19AM
(#18606286)
Maybe, but in the past, we've detected plagiarism in a different way: just look at the assembly output of the compiled code. The compiler is a good normalizer that removes artificial differences like naming of variables and functions.
Also, props for an academic work having an extensive README! https://github.com/tech-srl/code2vec
I do wonder if some sort of AST normalization would improve the input signal. Example 8 on the website shows their system correctly identifying an isPrime function. However some irrelevant perturbations can break it. If you swap the if statement condition around from `n % i == 0` to `0 == n % i` the proposed names are totally different and make no sense.