News for hackers. Stuff that matters.
Re:Teaching an AI to write Python code with Python code by sevenless on Thursday July 14, 2016 @10:35AM (#12094139)
Look, I was told that I wouldn't be automated out of my job for at least the next five years. Can't they start with Java?
Re:Teaching an AI to write Python code with Python code by skykooler on Thursday July 14, 2016 @12:08PM (#12095002)
Java is so verbose, any character-based network will probably get sidetracked before finishing a function declaration...
Re:Teaching an AI to write Python code with Python code by harryf on Thursday July 14, 2016 @01:22PM (#12095664)
...thereby becoming indistinguishable from the average Java developer
Re:Teaching an AI to write Python code with Python code by n0us on Thursday July 14, 2016 @01:24PM (#12095681)
You can never fire the AI because without it the whole place would burn down and nobody else understands how the code works.
Re:Teaching an AI to write Python code with Python code by RodgerTheGreat on Thursday July 14, 2016 @09:58AM (#12093788)
Python's context-sensitive grammar makes it a particularly unsuitable target for text-based generation of code in this manner. If you continue with this project I expect you will find you get far better results from generating ASTs or choosing a language with a simple grammar in which most possible compositions of tokens are valid.
Re:Teaching an AI to write Python code with Python code by woah on Thursday July 14, 2016 @11:20AM (#12094592)
Read the article, these type of algorithms have an easy time with syntax. The real issue is that the code produced is meaningless.
Re:Teaching an AI to write Python code with Python code by dasboth on Thursday July 14, 2016 @11:49AM (#12094826)
Exactly, the difficulty is not really in producing valid code but meaningful code. Same with text generation - while a recurrent neural network might produce grammatically correct sentences, I don't think we're close to it producing an story with an actual plot, discernible characters etc.
Re:Teaching an AI to write Python code with Python code by iandanforth on Thursday July 14, 2016 @12:28PM (#12095200)
What about a statically analyzable language? That could be factored into the loss function.
Re:Teaching an AI to write Python code with Python code by king_phil on Thursday July 14, 2016 @04:16PM (#12096861)
I was thinking the same. Not only that, if you would add multiple networks that, for example, weigh the possibility that a full line is "good" code, and another that evaluates a whole block (like google deep mind did with AlphaGo) so it looks like dense and complex code this could be a nice program trolling with pull requests on github :-D
Re:Teaching an AI to write Python code with Python code by kordless on Thursday July 14, 2016 @11:40AM (#12094756)
> The real issue is that the code produced is meaningless.

Sounds like something I'd code up.

Re:Teaching an AI to write Python code with Python code by jasikpark on Thursday July 14, 2016 @11:14AM (#12094528)
So... some form of lisp would probably be best, right? Or maybe just binary or assembly?
Re:Teaching an AI to write Python code with Python code by aab0 on Thursday July 14, 2016 @12:21PM (#12095126)
So it's just a char-RNN? I was hoping this was using one of the seq2seq frameworks for actually writing code, like https://arxiv.org/abs/1605.06640
Re:Teaching an AI to write Python code with Python code by transcranial on Thursday July 14, 2016 @12:37PM (#12095295)
Yeah, there's no effort to direct or encode intent. It's just producing what it probabilistically wants to produce. If it happens to run...cool?

Here's a interesting example from Google DeepMind learning to generate code for Magic The Gathering and Hearthstone: http://arxiv.org/pdf/1603.06744v2.pdf

Re:Teaching an AI to write Python code with Python code by ElHacker on Thursday July 14, 2016 @11:48AM (#12094818)
This is a cool project. I did something similar with LSTM in Tensorflow to generate Reddit comments. The biggest problem I found in my experiment is that the comments generated had not real meaning, nor even tried to deliver a message. Real Reddit users identified this right away, resulting in my Bot being banned. I think the author faced the same issues here.

Does anyone has any suggestions on papers that try to solve that problem?

Re:Teaching an AI to write Python code with Python code by transcranial on Thursday July 14, 2016 @12:45PM (#12095348)
The problem is that the latent space of a model trained on all comments is still massive. For any sort of coherence, you need to condition the probabilities on smaller spaces, or enforce structural bounds.

Here's an example of a paper where they simultaneously optimize high-level semantics with token-level sequence probabilities: http://arxiv.org/pdf/1606.00776v2.pdf.

Re:Teaching an AI to write Python code with Python code by fao_ on Thursday July 14, 2016 @01:06PM (#12095519)
I don't have any papers, but I guess you could try and scrape other short comments on the same article and basing it of those?
Re:Teaching an AI to write Python code with Python code by upatricck on Thursday July 14, 2016 @12:07PM (#12094992)
What should we do, If computers are going to be coding?
Re:Teaching an AI to write Python code with Python code by sevenless on Thursday July 14, 2016 @12:23PM (#12095145)
Unionize?
Re:Teaching an AI to write Python code with Python code by aangjie on Thursday July 14, 2016 @12:04PM (#12094969)
It'd be interesting to make sure the minimum data (code) sent to the neural network is all meaningful or purely functional. Perhaps as somebody pointed out taking ast and then figuring out stateless chunks might be a good idea?? I'll take a shot..
Re:Teaching an AI to write Python code with Python code by ankurdhama on Thursday July 14, 2016 @11:59PM (#12098863)
Much like I can learn to speak Chinese by listening lots of sound tracks of people speaking Chinese and over time building a probabilistic model of what sound will come next.
Re:Teaching an AI to write Python code with Python code by pmiller2 on Thursday July 14, 2016 @05:00PM (#12097126)
Here's a similar example that writes LaTeX code: http://karpathy.github.io/2015/05/21/rnn-effectiveness/
Re:Teaching an AI to write Python code with Python code by bbctol on Thursday July 14, 2016 @12:25PM (#12095171)
This is cute, but the title got me excited for something well beyond this. Heck, even if an AI produced spontaneously code that defined a function and later used it, I'd be ecstatic. This is just a fun piece of art.