{"id":19200287,"url":"https://github.com/lommix/snail_nn","last_synced_at":"2025-05-09T02:23:45.931Z","repository":{"id":181173456,"uuid":"665923060","full_name":"Lommix/snail_nn","owner":"Lommix","description":"Neural network and matrix library with parallized learning build from the ground up. Educational project.","archived":false,"fork":false,"pushed_at":"2023-10-17T22:03:41.000Z","size":633,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-14T13:10:47.684Z","etag":null,"topics":["ai","calculus","gradient-descent","machine-learning","matrix-library","neural-network","parallelism"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Lommix.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,"governance":null}},"created_at":"2023-07-13T09:51:40.000Z","updated_at":"2024-01-18T11:23:14.000Z","dependencies_parsed_at":"2023-07-14T11:15:12.225Z","dependency_job_id":"5b855495-638e-4d3a-b17d-c9b868984594","html_url":"https://github.com/Lommix/snail_nn","commit_stats":null,"previous_names":["lommix/snail_nn"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lommix%2Fsnail_nn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lommix%2Fsnail_nn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lommix%2Fsnail_nn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lommix%2Fsnail_nn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Lommix","download_url":"https://codeload.github.com/Lommix/snail_nn/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253176759,"owners_count":21866202,"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":["ai","calculus","gradient-descent","machine-learning","matrix-library","neural-network","parallelism"],"created_at":"2024-11-09T12:31:45.670Z","updated_at":"2025-05-09T02:23:45.861Z","avatar_url":"https://github.com/Lommix.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [WIP] Snail NN - smol neural network library\n\nMinimalistic CPU based neural network library with backpropagation and parallelized stochastic gradient descent.\n\n## Examples\n\nStoring images inside the neural network, upscaling and interpolate between them.\n\n```bash\ncargo run --example imagepol --release\n```\n\n![image](docs/example_interpolation.png)\n\n---\n\nThe mandatory xor example\n\n```bash\ncargo run --example xor --release\n```\n\n![image](docs/xor.png)\n\n---\n\nExample Code:\n\n```rust\nuse snail_nn::prelude::*;\n\nfn main(){\n    let mut nn = Model::new(\u0026[2, 3, 1]);\n    nn.set_activation(Activation::Sigmoid)\n\n    let mut batch = TrainingBatch::empty(2, 1);\n    let rate = 1.0;\n\n    // AND - training data\n    batch.add(\u0026[0.0, 0.0], \u0026[0.0]);\n    batch.add(\u0026[1.0, 0.0], \u0026[0.0]);\n    batch.add(\u0026[0.0, 1.0], \u0026[0.0]);\n    batch.add(\u0026[1.0, 1.0], \u0026[1.0]);\n\n    for _ in 0..10000 {\n        let (w_gradient, b_gradient) = nn.gradient(\u0026batch.random_chunk(2));\n        nn.learn(w_gradient, b_gradient, rate);\n    }\n\n    println!(\"ouput {:?} expected: 0.0\", nn.forward(\u0026[0.0, 0.0]));\n    println!(\"ouput {:?} expected: 0.0\", nn.forward(\u0026[1.0, 0.0]));\n    println!(\"ouput {:?} expected: 0.0\", nn.forward(\u0026[0.0, 1.0]));\n    println!(\"ouput {:?} expected: 1.0\", nn.forward(\u0026[1.0, 1.0]));\n}\n```\n\n## Features\n\n-   Sigmoid, Tanh \u0026 Relu activation functions\n-   Parallelized stochastic gradient descent\n\n## Todos\n\n-   Wgpu compute shaders\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flommix%2Fsnail_nn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flommix%2Fsnail_nn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flommix%2Fsnail_nn/lists"}