{"id":17717436,"url":"https://github.com/yovanoc/synaps","last_synced_at":"2025-03-31T12:21:58.061Z","repository":{"id":65511474,"uuid":"107396420","full_name":"yovanoc/synaps","owner":"yovanoc","description":"TypeScript Neural Network Library","archived":false,"fork":false,"pushed_at":"2017-12-09T00:47:21.000Z","size":71,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-01-05T07:05:26.006Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/yovanoc.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-10-18T11:04:41.000Z","updated_at":"2018-12-29T09:00:29.000Z","dependencies_parsed_at":"2023-01-26T18:45:20.072Z","dependency_job_id":null,"html_url":"https://github.com/yovanoc/synaps","commit_stats":null,"previous_names":[],"tags_count":1,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yovanoc%2Fsynaps","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yovanoc%2Fsynaps/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yovanoc%2Fsynaps/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yovanoc%2Fsynaps/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yovanoc","download_url":"https://codeload.github.com/yovanoc/synaps/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246465385,"owners_count":20781944,"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-10-25T14:20:51.243Z","updated_at":"2025-03-31T12:21:58.033Z","avatar_url":"https://github.com/yovanoc.png","language":"TypeScript","readme":"# Synaps\n\nTypeScript Neural Network Library\n\n## Installation\n\n * In the browser\n\n   ```html\n   \u003cscript type=\"text/javascript\" src=\"https://unpkg.com/synaps\"\u003e\u003c/script\u003e\n   ```\n\n * In Node.js\n\n   ```\n   $ npm install synaps\n   ```\n\n   and\n\n   ```javascript\n   const synaps = require(\"synaps\").default;\n   ```\n\n   or in es6 or TypeScript\n\n   ```javascript\n   import synaps from \"synaps\";\n   ```\n\n## Usage\n\n * Creating a new instance\n\n   * Neural network with 3 input neurons and 1 output neuron\n\n     ```javascript\n     let network = new synaps.Network.Type.FeedForward(3, [], 1);\n     ```\n\n   * Neural network with 4 input neurons, 3 hidden neurons and 2 output neurons\n\n     ```javascript\n     let network = new synaps.Network.Type.FeedForward(4, [ 3 ], 2);\n     ```\n\n   * Neural network with 6 input neurons, two hidden layers with 4 and 2 neurons, and 3 output neurons\n\n     ```javascript\n     let network = new synaps.Network.Type.FeedForward(6, [ 4, 2 ], 3);\n     ```\n\n * Passing any number of additional options to the network\n\n   ```javascript\n   // pass an object containing the desired options as the fourth parameter\n   let network = new synaps.Network.Type.FeedForward(3, [ 4 ], 1, {\n       seed: 501935,\n       learningRate: 0.3,\n       hiddenLayerActivationFunction: new synaps.Activation.HyperbolicTangent(),\n       outputLayerActivationFunction: new synaps.Activation.BinaryStep()\n   });\n   ```\n\n * Available activation functions\n\n   ```javascript\n   new synaps.Activation.ArcTangent();\n   new synaps.Activation.BinaryStep();\n   new synaps.Activation.GaussianFunction();\n   new synaps.Activation.HyperbolicTangent();\n   new synaps.Activation.Identity();\n   new synaps.Activation.LogisticFunction();\n   new synaps.Activation.RectifiedLinearUnit();\n   new synaps.Activation.RectifiedLinearUnit(0.01);\n   new synaps.Activation.SinusoidFunction();\n   ```\n\n * Training the network using supervised batch (\"all-at-once\") learning\n\n   ```javascript\n   // the first parameter is the array of inputs and the second parameter is the array of desired outputs\n   // the third parameter is the optional number of iterations and the fourth parameter is the optional error threshold\n   let error = network.trainBatch(\n       [\n           [0, 0, 1],\n           [0, 1, 1],\n           [1, 0, 1],\n           [1, 1, 1]\n       ],\n       [\n           [ 0 ],\n           [ 1 ],\n           [ 1 ],\n           [ 0 ]\n       ],\n       60000,\n       0.005\n   );\n   ```\n\n * Training the network using supervised online (\"single-pattern\") learning\n\n   ```javascript\n   // the first parameter is the input and the second parameter is the desired output\n   let error = network.train([0, 0, 1], [ 0 ]);\n   ```\n\n * Asking the network to predict some output from a supplied input pattern\n\n   ```javascript\n   // the single parameter is the input to process\n   network.predict([ 0, 0, 1 ])\n   ```\n\n * Saving the network with all its properties to a JSON string\n\n   ```javascript\n   let jsonStr = JSON.stringify(network);\n   ```\n\n * Restoring the network with all its properties from a JSON string\n\n   ```javascript\n   let network = synaps.Network.Type.FeedForward.fromJson(jsonStr);\n   ```\n\n## Development\n\n * Prerequisites\n\n   ```\n   $ npm install\n   ```\n\n* Lint the js files\n\n    ```\n    $ npm lint\n    ```\n    or to fix some errors automatically\n    ```\n    $ npm lint:fix\n    ```  \n\n\n* Build the js files\n\n    ```\n    $ npm build\n    ```  \n\n * Running the Node.js examples\n\n   ```\n   $ node examples/node.js\n   ```\n\n## Contributing\n\nAll contributions are welcome! If you wish to contribute, please create an issue first so that your feature, problem or question can be discussed.\n\n### Socials Links\n\n- [Discord](https://discord.gg/hUTW6jQ)\n- [Slack](https://join.slack.com/t/synapsworkspace/shared_invite/enQtMjU4NjU4NzgwNDY2LWU4M2I0MWFlYzYxYzVjMjIyMzdkOTAzNDc4MzI4ZDAzM2ExYmVmYWIzZTAzMDcwNGFiZjNiOWQzNzkxNWEwYWQ)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyovanoc%2Fsynaps","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyovanoc%2Fsynaps","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyovanoc%2Fsynaps/lists"}