{"id":19204391,"url":"https://github.com/vxern/synadart","last_synced_at":"2025-06-14T11:36:14.533Z","repository":{"id":56841006,"uuid":"358988273","full_name":"vxern/synadart","owner":"vxern","description":"🧠 A simple, fully documented neural network library created for educational purposes, heavily inspired by the `ai` package.","archived":false,"fork":false,"pushed_at":"2023-10-31T23:12:35.000Z","size":97,"stargazers_count":14,"open_issues_count":2,"forks_count":8,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-08T19:50:13.760Z","etag":null,"topics":["complete","confidence","dart","dartlang","documented","educational","extensive","neural-network","nn"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/synadart","language":"Dart","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/vxern.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-04-17T21:42:44.000Z","updated_at":"2024-10-11T11:22:37.000Z","dependencies_parsed_at":"2023-08-09T13:36:38.052Z","dependency_job_id":"ae36df27-9f56-438a-9f4e-4d1bd2c6e25d","html_url":"https://github.com/vxern/synadart","commit_stats":null,"previous_names":["vxern/synadart","wordcollector/synadart"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vxern%2Fsynadart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vxern%2Fsynadart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vxern%2Fsynadart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vxern%2Fsynadart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vxern","download_url":"https://codeload.github.com/vxern/synadart/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253767689,"owners_count":21961158,"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":["complete","confidence","dart","dartlang","documented","educational","extensive","neural-network","nn"],"created_at":"2024-11-09T13:07:41.472Z","updated_at":"2025-05-12T15:46:04.758Z","avatar_url":"https://github.com/vxern.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# synadart\n\nThe `synadart` library can be used to create neural networks of any complexity,\nas well as learn from the source code by studying its extremely clean\nimplementation.\n\n## Launching our first network\n\nTo begin using the `synadart`, we must first import it into our project:\n\n```dart\nimport 'package:synadart/synadart.dart';\n```\n\nNext, we must create a network of our chosen type. Let's create a sequential\nnetwork, in which every layer has one input and one output tensor. This should\nbe pretty easy:\n\n```dart\nfinal network = Sequential(learningRate: 0.3);\n```\n\nOur network is currently empty; it contains no layers and therefore no neurons.\nLet's add three layers; the input layer, one hidden layer and the output layer:\n\n```dart\nnetwork.addLayers([\n  Dense(15, activationAlgorithm: ActivationAlgorithm.sigmoid),\n  Dense(5, activationAlgorithm: ActivationAlgorithm.sigmoid),\n  Dense(1, activationAlgorithm: ActivationAlgorithm.sigmoid),\n]);\n```\n\nNow that our network has some structure to it, we can begin using it.. No, not\nquite yet. Our network is still not trained, and has no clue what it is doing.\nTime to train it.\n\nFirstly, we will create a list of _expected_ values, i.e. _values we are\nexpecting the network to output_. Here, we are expecting to get the number '5'.\n\n```dart\nfinal expected = [\n  [0.01], // 0\n  [0.01], // 1\n  [0.01], // 2\n  [0.01], // 3\n  [0.01], // 4\n  [0.99], // 5 ( This is what we are anticipating )\n  [0.01], // 6\n  [0.01], // 7\n  [0.01], // 8\n  [0.01], // 9\n];\n```\n\nFantastic, we are now expecting our infantile network to magically output a\nnumber 5, not having taught it a thing. Oh, right - that's where the training\ndata part comes in!\n\nWe must now tell the network what each of our expected output values is\nassociated with. Let's teach it some numbers:\n\n```dart\nfinal trainingData = [\n  '111101101101111'.split('').map(double.parse).toList(), // Pixel representation of a 0,\n  '001001001001001'.split('').map(double.parse).toList(), // a 1,\n  '111001111100111'.split('').map(double.parse).toList(), // a 2,\n  '111001111001111'.split('').map(double.parse).toList(), // a 3,\n  '101101111001001'.split('').map(double.parse).toList(), // a 4,\n  '111100111001111'.split('').map(double.parse).toList(), // a 5,\n  '111100111101111'.split('').map(double.parse).toList(), // a 6,\n  '111001001001001'.split('').map(double.parse).toList(), // a 7,\n  '111101111101111'.split('').map(double.parse).toList(), // an 8,\n  '111101111001111'.split('').map(double.parse).toList(), // and a 9.\n];\n```\n\nNow that we granted our network a grand total of 10 numbers to learn, we can\nbegin training the network using the values we've set up:\n\n```dart\nnetwork.train(inputs: trainingData, expected: expected, iterations: 5000);\n```\n\nWonderful! We've trained our network using the pixel representation of number\nimages, and our network is now able to recognise the number '5' with relative\nconfidence. The last step is to test our network's capabilities ourselves.\n\nLet's give our network a couple pixel representations of distorted images of the\nnumber '5':\n\n```dart\nfinal testData = [\n  '111100111000111'.split('').map(double.parse).toList(),\n  '111100010001111'.split('').map(double.parse).toList(),\n  '111100011001111'.split('').map(double.parse).toList(),\n  '110100111001111'.split('').map(double.parse).toList(),\n  '110100111001011'.split('').map(double.parse).toList(),\n  '111100101001111'.split('').map(double.parse).toList(),\n];\n```\n\nTo check the confidence of the network in recognising distorted '5's:\n\n```dart\nfor (final test in testData) {\n  print('Confidence in recognising a distorted 5: ${network.process(test)}');\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvxern%2Fsynadart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvxern%2Fsynadart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvxern%2Fsynadart/lists"}