{"id":26467448,"url":"https://github.com/liquidcarrot/carrot","last_synced_at":"2025-04-09T17:20:10.837Z","repository":{"id":33788440,"uuid":"160243060","full_name":"liquidcarrot/carrot","owner":"liquidcarrot","description":"🥕 Evolutionary Neural Networks in JavaScript","archived":false,"fork":false,"pushed_at":"2023-01-07T02:40:18.000Z","size":17864,"stargazers_count":295,"open_issues_count":103,"forks_count":33,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-04-09T17:19:59.367Z","etag":null,"topics":["browser","easy-to-use","javascript","lstm","machine-learning","neat","neural-networks","neuro-evolution","nodejs","recurrent-neural-networks"],"latest_commit_sha":null,"homepage":"https://liquidcarrot.io/carrot/","language":"JavaScript","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/liquidcarrot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":null,"patreon":"liquidcarrot","open_collective":"liquidcarrot","ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2018-12-03T19:31:26.000Z","updated_at":"2025-02-08T13:33:25.000Z","dependencies_parsed_at":"2023-01-15T02:45:34.733Z","dependency_job_id":null,"html_url":"https://github.com/liquidcarrot/carrot","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liquidcarrot%2Fcarrot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liquidcarrot%2Fcarrot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liquidcarrot%2Fcarrot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liquidcarrot%2Fcarrot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/liquidcarrot","download_url":"https://codeload.github.com/liquidcarrot/carrot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248074922,"owners_count":21043490,"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":["browser","easy-to-use","javascript","lstm","machine-learning","neat","neural-networks","neuro-evolution","nodejs","recurrent-neural-networks"],"created_at":"2025-03-19T14:43:49.476Z","updated_at":"2025-04-09T17:20:10.801Z","avatar_url":"https://github.com/liquidcarrot.png","language":"JavaScript","funding_links":["https://patreon.com/liquidcarrot","https://opencollective.com/liquidcarrot","https://www.patreon.com/liquidcarrot"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n \u003cimg src=\"https://raw.githubusercontent.com/liquidcarrot/carrot/master/images/carrot-logo_readme.png\" alt=\"Carrot Logo\" width=\"600px\"/\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://travis-ci.org/liquidcarrot/carrot\"\u003e\n        \u003cimg src=\"https://travis-ci.org/liquidcarrot/carrot.svg?branch=master\"\n             alt=\"Build Status via Travis CI\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://www.codacy.com/app/christianechevarria/carrot?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=liquidcarrot/carrot\u0026amp;utm_campaign=Badge_Grade\"\u003e\n        \u003cimg src=\"https://api.codacy.com/project/badge/Grade/3ee723b170f14b4990c8a0a6fc1feb27\"\n             alt=\"Codacy Badge\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://coveralls.io/github/liquidcarrot/carrot?branch=master\"\u003e\n        \u003cimg src=\"https://coveralls.io/repos/github/liquidcarrot/carrot/badge.svg?branch=master\"\n             alt=\"Coverage Status\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://discord.gg/P4FJG8rEYC\"\u003e\n        \u003cimg src=\"https://img.shields.io/discord/800482235852914698\" alt=\"Join the chat on Discord at https://discord.gg/P4FJG8rEYC\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"/LICENSE\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/License-MIT-blue.svg\"\n             alt=\"Carrot's License\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/liquidcarrot/carrot/issues\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Made%20with%20%E2%99%A5%20by-Liquid%20Carrot-ff1414.svg\"\n             alt=\"Made with love\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n\u003ch4\u003eℹ️ The new TypeScript version is coming! If you would like to try the expiremental version please clone the repository and checkout the typescript branch of the project. Docs for this new version can temporarily be found \u003ca href=\"https://raimannma.github.io/carrot/index.html\"\u003ehere\u003c/a\u003e\u003c/h4\u003e\n\n\u003cp\u003e\n  Carrot is an architecture-free neural network library built around neuroevolution\n\u003c/p\u003e\n\n\u003cp\u003e\n Why / when should I use this?\n \n Whenever you have a problem that you:\n \n - Don't know how-to solve\n - Don't want to design a custom network for\n - Want to discover the ideal neural-network structure for\n\nYou can use Carrot's ability to **design networks of arbitrary complexity by itself** to solve whatever problem you have. If you want to see Carrot designing a neural-network to play flappy-bird [check here](https://liquidcarrot.io/example.flappy-bird/)\n \n\u003c/p\u003e\n\nFor Documentation, visit [here](https://liquidcarrot.github.io/carrot)\n\n## Key Features\n- [Simple docs](https://liquidcarrot.github.io/carrot) \u0026 [interactive examples](https://liquidcarrot.io/example.flappy-bird/)\n- **Neuro-evolution** \u0026 population based training\n- Multi-threading \u0026 GPU (coming soon)\n- Preconfigured GRU, LSTM, NARX Networks\n- Mutable Neurons, Layers, Groups, and Networks\n- SVG Network Visualizations using D3.js\n\n## Demos\n![flappy bird neuro-evolution demo](https://raw.githubusercontent.com/liquidcarrot/carrot/master/images/flappy-bird-demo.gif)\n\u003cbr\u003e\n[Flappy bird neuro-evolution](https://liquidcarrot.io/example.flappy-bird/ \"flappy bird playground\")\n\n\n## Install\n\n```bash\n$ npm i @liquid-carrot/carrot\n```\n\nCarrot files are hosted by JSDelivr\n\nFor prototyping or learning, use the latest version here:\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/@liquid-carrot/carrot/dist/carrot.umd2.min.js\"\u003e\u003c/script\u003e\n```\n\nFor production, link to a specific version number to avoid unexpected breakage from newer versions:\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/@liquid-carrot/carrot@0.3.17/dist/carrot.umd2.min.js\"\u003e\u003c/script\u003e\n```\n\n## Getting Started\n\n💡 Want to be super knowledgeable about neuro-evolution in a few minutes?\n\nCheck out [this article](https://www.oreilly.com/radar/neuroevolution-a-different-kind-of-deep-learning/ \"Neuro-evolution based deep learning\") by the creator of NEAT, Kenneth Stanley\n\n💡 Curious about how neural-networks can understand speech and video?\n\nCheck out [this video on Recurrent Neural Networks](https://www.youtube.com/watch?v=LHXXI4-IEns), from [@LearnedVector](https://github.com/LearnedVector), on YouTube\n\nThis is a simple **perceptron**:\n\n![perceptron](http://www.codeproject.com/KB/dotnet/predictor/network.jpg).\n\nHow to build it with Carrot:\n\n```javascript\nlet { architect } = require('@liquid-carrot/carrot');\n\n// The example Perceptron you see above with 4 inputs, 5 hidden, and 1 output neuron\nlet simplePerceptron = new architect.Perceptron(4, 5, 1);\n```\n\nBuilding networks is easy with **6** built-in networks\n\n```javascript\nlet { architect } = require('@liquid-carrot/carrot');\n\nlet LSTM = new architect.LSTM(4, 5, 1);\n\n// Add as many hidden layers as needed\nlet Perceptron = new architect.Perceptron(4, 5, 20, 5, 10, 1);\n```\n\nBuilding custom network architectures\n\n```javascript\nlet architect = require('@liquid-carrot/carrot').architect\nlet Layer = require('@liquid-carrot/carrot').Layer\n\nlet input = new Layer.Dense(1);\nlet hidden1 = new Layer.LSTM(5);\nlet hidden2 = new Layer.GRU(1);\nlet output = new Layer.Dense(1);\n\n// connect however you want\ninput.connect(hidden1);\nhidden1.connect(hidden2);\nhidden2.connect(output);\n\nlet network = architect.Construct([input, hidden1, hidden2, output]);\n```\n\nNetworks also shape **themselves** with neuro-evolution\n\n```javascript\nlet { Network, methods } = require('@liquid-carrot/carrot');\n\n// this network learns the XOR gate (through neuro-evolution)\nasync function execute () {\n  // no hidden layers...\n   var network = new Network(2,1);\n\n   // XOR dataset\n   var trainingSet = [\n       { input: [0,0], output: [0] },\n       { input: [0,1], output: [1] },\n       { input: [1,0], output: [1] },\n       { input: [1,1], output: [0] }\n   ];\n\n   await network.evolve(trainingSet, {\n       mutation: methods.mutation.FFW,\n       equal: true,\n       error: 0.05,\n       elitism: 5,\n       mutation_rate: 0.5\n   });\n\n   // and it works!\n   network.activate([0,0]); // 0.2413\n   network.activate([0,1]); // 1.0000\n   network.activate([1,0]); // 0.7663\n   network.activate([1,1]); // 0.008\n}\n\nexecute();\n```\n\nBuild vanilla neural networks\n\n```javascript\nlet Network = require('@liquid-carrot/carrot').Network\n\nlet network = new Network([2, 2, 1]) // Builds a neural network with 5 neurons: 2 + 2 + 1\n```\n\nOr implement custom algorithms with neuron-level control\n\n```javascript\nlet Node = require('@liquid-carrot/carrot').Node\n\nlet A = new Node() // neuron\nlet B = new Node() // neuron\n\nA.connect(B)\nA.activate(0.5)\nconsole.log(B.activate())\n```\n\n## Try with\n\n#### Data Sets\n - [ ] [MNIST](https://www.npmjs.com/package/mnist)\n\n\n## Contributors ✨\n\nThis project exists thanks to all the people who contribute. We can't do it without you! 🙇\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://liquidcarrot.io/\"\u003e\u003cimg src=\"https://avatars3.githubusercontent.com/u/21148993?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eLuis Carbonell\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/liquidcarrot/carrot/commits?author=luiscarbonell\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"#ideas-luiscarbonell\" title=\"Ideas, Planning, \u0026 Feedback\"\u003e🤔\u003c/a\u003e \u003ca href=\"https://github.com/liquidcarrot/carrot/pulls?q=is%3Apr+reviewed-by%3Aluiscarbonell\" title=\"Reviewed Pull Requests\"\u003e👀\u003c/a\u003e \u003ca href=\"https://github.com/liquidcarrot/carrot/commits?author=luiscarbonell\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"http://liquidcarrot.io\"\u003e\u003cimg src=\"https://avatars2.githubusercontent.com/u/23618650?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eChristian Echevarria\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/liquidcarrot/carrot/commits?author=christianechevarria\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/liquidcarrot/carrot/commits?author=christianechevarria\" title=\"Documentation\"\u003e📖\u003c/a\u003e \u003ca href=\"#infra-christianechevarria\" title=\"Infrastructure (Hosting, Build-Tools, etc)\"\u003e🚇\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/dan-ryan\"\u003e\u003cimg src=\"https://avatars1.githubusercontent.com/u/775672?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eDaniel Ryan\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/liquidcarrot/carrot/issues?q=author%3Adan-ryan\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e \u003ca href=\"https://github.com/liquidcarrot/carrot/pulls?q=is%3Apr+reviewed-by%3Adan-ryan\" title=\"Reviewed Pull Requests\"\u003e👀\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/IviieMtz\"\u003e\u003cimg src=\"https://avatars0.githubusercontent.com/u/50965172?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eIviieMtz\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/liquidcarrot/carrot/commits?author=IviieMtz\" title=\"Tests\"\u003e⚠️\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/nicszerman\"\u003e\u003cimg src=\"https://avatars3.githubusercontent.com/u/14032356?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eNicholas Szerman\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/liquidcarrot/carrot/commits?author=nicszerman\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"http://www.threeceemedia.com\"\u003e\u003cimg src=\"https://avatars3.githubusercontent.com/u/1046501?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003etracy collins\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/liquidcarrot/carrot/issues?q=author%3Atracycollins\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/raimannma\"\u003e\u003cimg src=\"https://avatars3.githubusercontent.com/u/26171511?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eManuel Raimann\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/liquidcarrot/carrot/issues?q=author%3Araimannma\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e \u003ca href=\"https://github.com/liquidcarrot/carrot/commits?author=raimannma\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"#ideas-raimannma\" title=\"Ideas, Planning, \u0026 Feedback\"\u003e🤔\u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-enable --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n\n\n## 💬 Contributing\n\n[![Carrot's GitHub Issues](https://img.shields.io/github/issues/liquidcarrot/carrot.svg)](https://github.com/liquidcarrot/carrot/issues)\n\nYour contributions are always welcome! Please have a look at the [contribution guidelines](https://github.com/liquidcarrot/carrot/blob/master/CONTRIBUTING.md) first. 🎉\n\nTo build a community welcome to all, Carrot follows the [Contributor Covenant](https://github.com/liquidcarrot/carrot/blob/master/CODE_OF_CONDUCT.md) Code of Conduct.\n\nAnd finally, a big thank you to all of you for supporting! 🤗\n\n\u003cdetails\u003e\u003csummary\u003e\u003cstrong\u003ePlanned Features\u003c/strong\u003e\u003c/summary\u003e\n* [ ] Performance Enhancements\n    * [ ] GPU Acceleration\n        * [ ] Tests\n        * [ ] Benchmarks\n    * [ ] Matrix Multiplications\n        * [ ] Tests\n        * [ ] Benchmarks\n    * [ ] Clustering | Multi-Threading\n        * [ ] Tests\n        * [ ] Benchmarks\n* [ ] Syntax Support\n    * [ ] Callbacks\n    * [ ] Promises\n    * [ ] Streaming\n    * [ ] Async/Await\n* [ ] Math Support\n    * [ ] Big Numbers\n    * [ ] Small Numbers\n\u003c/details\u003e\n\n## Patrons\n[![Carrot's Patrons](https://img.shields.io/endpoint.svg?color=blue\u0026label=patrons\u0026logo=patrons\u0026url=https%3A%2F%2Fshieldsio-patreon.herokuapp.com%2Fliquidcarrot)](https://www.patreon.com/liquidcarrot)\n\n[![Become a Patron](https://c5.patreon.com/external/logo/become_a_patron_button.png)](https://www.patreon.com/liquidcarrot)\n\n## Acknowledgements\n\nA special thanks to:\n\n[@wagenaartje](https://github.com/wagenaartje) for [Neataptic](https://github.com/wagenaartje/neataptic/) which was the starting point for this project\n\n[@cazala](https://github.com/cazala) for [Synaptic](https://github.com/cazala/synaptic/) which pioneered architecture free neural networks in javascript and was the starting point for Neataptic\n\n[@robertleeplummerjr](https://github.com/robertleeplummerjr) for [GPU.js](https://github.com/gpujs/gpu.js) which makes using GPU in JS easy and [Brain.js](https://github.com/BrainJS/brain.js) which has inspired Carrot's development\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliquidcarrot%2Fcarrot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fliquidcarrot%2Fcarrot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliquidcarrot%2Fcarrot/lists"}