{"id":13595939,"url":"https://github.com/kootenpv/neural_complete","last_synced_at":"2025-04-12T20:45:22.713Z","repository":{"id":43583793,"uuid":"86944914","full_name":"kootenpv/neural_complete","owner":"kootenpv","description":"A neural network trained to help writing neural network code using autocomplete","archived":false,"fork":false,"pushed_at":"2020-12-23T13:35:35.000Z","size":3580,"stargazers_count":1154,"open_issues_count":5,"forks_count":121,"subscribers_count":42,"default_branch":"master","last_synced_at":"2025-04-04T00:09:39.190Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kootenpv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-01T21:50:11.000Z","updated_at":"2025-03-22T17:40:28.000Z","dependencies_parsed_at":"2022-07-12T18:19:12.195Z","dependency_job_id":null,"html_url":"https://github.com/kootenpv/neural_complete","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kootenpv%2Fneural_complete","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kootenpv%2Fneural_complete/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kootenpv%2Fneural_complete/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kootenpv%2Fneural_complete/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kootenpv","download_url":"https://codeload.github.com/kootenpv/neural_complete/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248631688,"owners_count":21136556,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T16:02:01.783Z","updated_at":"2025-04-12T20:45:22.691Z","avatar_url":"https://github.com/kootenpv.png","language":"Python","funding_links":[],"categories":["Python","Table of Contents"],"sub_categories":[],"readme":"# Neural Complete\n\n[Neural Complete](https://github.com/kootenpv/neural_complete) is autocomplete based on a [generative](https://blog.openai.com/generative-models/) [LSTM](https://colah.github.io/posts/2015-08-Understanding-LSTMs/) [neural network](https://keras.io), trained not only *by* python code but also *on* python source code.\n\nIronically, it is trained on files containing [keras](https://keras.io/) imports. The result is a neural network trained to help writing neural network code.\n\nRather than completing a word, it will suggest finishing a whole line. It uses information from previous lines to make a suggestion.\n\nOne could imagine that everyone will have a neural network to automagically complete their personal scripts based on their own neural model :-)\n\nBut not yet with this code.\n\nYou're encouraged to train on your own data, which should be made easier by using Neural Complete.\n\n\n### Demo\n\n![Neural Complete demo](/images/demo.gif)\n\nThe first time `model` is written, it suggests to create it as a variable (`model = Sequential()`).\n\nThe second time `model` is written, it suggests using it instead (`model.add(...)`). It shows that it is able to use the context!\n\nThe final line does contain mistakes, but should get more precise with more data and also more context.\n\n### Models\n\nThere are 2 models included, a character based model and a python token model. The benefit of the char based model is that it can complete at any moment, while the token based model only works with completed tokens (it cannot finish a word).\nHowever, the token based model is based on a higher level unit (semantic), and should make more sense most of the time.\n\nThe char based model looks back up to 80 characters, while the token based model looks back up to 20 tokens.\n\nIt would be very fun to experiment with a future model in which it will use the python [AST](https://docs.python.org/3/library/ast.html) and take out variable naming out of the equation.\n\n## Do It Yourself\n\n### Scraping data\n\nUnfortunately the Github API does not allow to search by filename, so I wrote a scraping script to gather python data specifically trained on keras source code. You can change the search query to gather your own data. Do not overdo it as to \"annoy\" github. You would need a lot more for a reasonable result!\n\nThe models have only been trained on 26 scripts.\n\n### Backend\n\nTrain a model using keras, serve it with flask.\n\nSee [backend](backend/)\n\n### Frontend\n\nThe frontend is a very thin layer communicating with the backend to receive autocomplete suggestions, written in [Angular 2](https://angular.io/). The dist folder has been included so you can easily run it yourself without dependencies.\n\nSee [frontend](frontend/)\n\n### Credits\n\nIt uses a lot of the ideas of the standard keras [LSTM text generation example](https://github.com/fchollet/keras/blob/master/examples/lstm_text_generation.py).\n\nWhenever using any of this code: please attribute whenever you can.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkootenpv%2Fneural_complete","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkootenpv%2Fneural_complete","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkootenpv%2Fneural_complete/lists"}