{"id":15984867,"url":"https://github.com/divineomega/simple-neural-network-js","last_synced_at":"2025-03-18T00:31:39.932Z","repository":{"id":57156164,"uuid":"100752684","full_name":"DivineOmega/simple-neural-network-js","owner":"DivineOmega","description":"Simple Neural Network library (JavaScript)","archived":false,"fork":false,"pushed_at":"2020-10-02T21:20:35.000Z","size":11,"stargazers_count":8,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-22T16:17:41.116Z","etag":null,"topics":["javascript","machine-learning","neural-network","neurons"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DivineOmega.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-08-18T21:50:19.000Z","updated_at":"2024-05-09T19:32:11.000Z","dependencies_parsed_at":"2022-08-28T13:30:13.750Z","dependency_job_id":null,"html_url":"https://github.com/DivineOmega/simple-neural-network-js","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/DivineOmega%2Fsimple-neural-network-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DivineOmega%2Fsimple-neural-network-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DivineOmega%2Fsimple-neural-network-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DivineOmega%2Fsimple-neural-network-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DivineOmega","download_url":"https://codeload.github.com/DivineOmega/simple-neural-network-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221703983,"owners_count":16866656,"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":["javascript","machine-learning","neural-network","neurons"],"created_at":"2024-10-08T02:10:53.055Z","updated_at":"2024-10-27T16:25:09.518Z","avatar_url":"https://github.com/DivineOmega.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple Neural Network library (JavaScript)\n\nThe point of this library is to allow very simple neural networks to be easily created, with no extra fluff.\n\n## Installation\n\nThis library can be easily installed with yarn or npm. The installation commands is as follows.\n\n```bash\nnpm install simple-neural-network-js # Install with NPM\nyarn add simple-neural-network-js    # Install with yarn\n```\n\n## Usage\n\n### Creating a neural network\n\nYou can create a new neural network with the following command.\n\n```js\nvar numInputs = 2;\nvar numOutputs = 2;\nvar numHiddenLayers = 2;\nvar numNeuronsPerHiddenLayer = 6;\n\nvar neuralNetwork = new NeuralNetwork(numInputs, numOutputs, numHiddenLayers, numNeuronsPerHiddenLayer);\n```\n\nThe `NeuralNetwork` constructor accepts parameters that defined the number of inputs and outputs the neural \nnetwork should have, the number of hidden layers that should exist and the number of neurons that should be \npresent in each hidden layer.\n\n### Using the neural network\n\nTo get outputs from the neural network, you must supply it with an array of inputs. This array's length should be\nequal to the number of inputs you set when creating the neural network.\n\nIdeally the inputs should be in a range from -1 to +1, but this is not required.\n\nOutputs are returned as an array of values from 0 to +1.\n\nThe `update` method is used to supply inputs to the neural network and retrieve outputs. An example usage is \nshown below.\n\n```js\nvar inputs = [0.12, 0.24];\nvar outputs = neuralNetwork.update(inputs);\n```\n\n## Getting and setting weights\n\nThe weights between the neurons be retrieved or overrided with the `getWeights` and `setWeights` methods. Examples\nof how to use these methods are shown below.\n\n```js\nvar weights = neuralNetwork.getWeights();\n\nvar newWeights = [];\nfor (var i=0; i \u003c weights.length; i++) {\n    newWeights.push(weights[i] * 0.5); \n}\n\nneuralNetwork.setWeights(newWeights);\n```\n\nWeights are returned by the `getWeights` as a single dimension array.\n\nNew weights must be provided to the `setWeights` method in the same order as they are retrieved by the `getWeights` method.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdivineomega%2Fsimple-neural-network-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdivineomega%2Fsimple-neural-network-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdivineomega%2Fsimple-neural-network-js/lists"}