{"id":18115473,"url":"https://github.com/d12/simpleneuralnetwork","last_synced_at":"2025-09-05T12:37:08.223Z","repository":{"id":47334926,"uuid":"122255178","full_name":"d12/SimpleNeuralNetwork","owner":"d12","description":"A simple neural network implementation in Ruby.","archived":false,"fork":false,"pushed_at":"2021-09-02T18:45:05.000Z","size":35,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2024-04-25T14:02:40.755Z","etag":null,"topics":["machine-learning","neural-network","ruby"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/d12.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-20T20:56:12.000Z","updated_at":"2021-09-02T18:45:07.000Z","dependencies_parsed_at":"2022-09-04T16:21:19.803Z","dependency_job_id":null,"html_url":"https://github.com/d12/SimpleNeuralNetwork","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/d12%2FSimpleNeuralNetwork","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d12%2FSimpleNeuralNetwork/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d12%2FSimpleNeuralNetwork/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d12%2FSimpleNeuralNetwork/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/d12","download_url":"https://codeload.github.com/d12/SimpleNeuralNetwork/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247463736,"owners_count":20942935,"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":["machine-learning","neural-network","ruby"],"created_at":"2024-11-01T03:10:04.526Z","updated_at":"2025-04-06T09:29:58.937Z","avatar_url":"https://github.com/d12.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SimpleNeuralNetwork\n\nThis is a simple neural network implementation in Ruby.\n\nThis gem does not include any learning implementations (back-prop, etc).\n\n## Installation\n\n```\ngem install simple_neural_network\n```\n\n## Sample usage:\n\n![Sample Neural Network](https://cdn-images-1.medium.com/max/1600/0*IUWJ5oJ_z6AiG7Ja.jpg)\n\nThe following code implements the above neural network.\n\n```ruby\nrequire 'simple_neural_network'\n\nnetwork = SimpleNeuralNetwork::Network.new\n\nnetwork.create_layer(neurons: 5)\nnetwork.create_layer(neurons: 7)\nnetwork.create_layer(neurons: 7)\nnetwork.create_layer(neurons: 4)\n```\n\nNeural networks are initialized with random edge weights and zero-valued neuron biases. Edge/bias initialization is configurable by setting the initialization lambdas.\n\nThe following code runs an input set against the network.\n\n```ruby\n network.run([0.5, 0.4, 0.8, 0, 0.9])\n =\u003e [0.2257, 0.7488, 0.1016, 0.9935]\n```\n\n## Manipulating the network\n\n### Setting a neuron bias\n\n```ruby\nnetwork.layers[layer_index].neurons[neuron_index].bias = new_neuron_bias\n```\n\n### Setting an edge weight\n\nIn `SimpleNeuralNetwork`, edges point forward and edge weights stored as an array of integers on a `Neuron` object. To access the edge pointing from a neuron to the `n'th` neuron in the next layer:\n\n```ruby\nnetwork.layers[layer_index].neurons[neuron_index].edges[n] = new_edge_weight\n```\n\n## Improvements / Bugs\nImprovements and bugs are listed as issues in the gem repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd12%2Fsimpleneuralnetwork","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fd12%2Fsimpleneuralnetwork","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd12%2Fsimpleneuralnetwork/lists"}