{"id":20450914,"url":"https://github.com/danhper/rust-simple-nn","last_synced_at":"2025-04-13T02:30:36.990Z","repository":{"id":139225813,"uuid":"81726261","full_name":"danhper/rust-simple-nn","owner":"danhper","description":"Simple neural network implementation in Rust","archived":false,"fork":false,"pushed_at":"2019-08-19T14:38:43.000Z","size":56,"stargazers_count":34,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-26T20:03:01.275Z","etag":null,"topics":["mnist","neural-networks","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/danhper.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-12T13:03:30.000Z","updated_at":"2024-06-13T13:35:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"b7ab993a-dfcc-49de-a1e0-e7ed44304f58","html_url":"https://github.com/danhper/rust-simple-nn","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/danhper%2Frust-simple-nn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danhper%2Frust-simple-nn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danhper%2Frust-simple-nn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danhper%2Frust-simple-nn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danhper","download_url":"https://codeload.github.com/danhper/rust-simple-nn/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248657795,"owners_count":21140841,"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":["mnist","neural-networks","rust"],"created_at":"2024-11-15T10:55:37.715Z","updated_at":"2025-04-13T02:30:36.980Z","avatar_url":"https://github.com/danhper.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# simple_nn\n[![Build Status](https://travis-ci.org/danhper/rust-simple-nn.svg?branch=master)](https://travis-ci.org/danhper/rust-simple-nn)\n\nSimple neural network implementation in Rust.\n\nNOTE: I wanted to give Rust a try, and decided to try implementing a simple NN framework,\nbut this is not meant to be used in production (the current implementation is way too slow for now anyway).\n\nHere is a small example for the mnist dataset.\n\n```rust\nextern crate simple_nn;\n\nuse simple_nn::{nn, utils};\n\nfn main() {\n    let mut network = nn::NetworkBuilder::new()\n        .add(nn::layers::Dense::new(784, 100))\n        .add(nn::layers::Relu::new())\n        .add(nn::layers::Dense::new(100, 100))\n        .add(nn::layers::Relu::new())\n        .add(nn::layers::Dense::new(100, 10))\n        .add_output(nn::layers::Softmax::new())\n        .minimize(nn::objectives::CrossEntropy::new())\n        .with(nn::optimizers::SGD::new(0.5))\n        .build();\n\n    println!(\"loading training data...\");\n\n    let x_train = utils::loader::matrix_from_txt(\"data/train_x_60000x784_float32.txt\").unwrap().transform(|v: f64| v / 255.0);\n    let y_train = utils::loader::matrix_from_txt(\"data/train_y_60000_int32.txt\").unwrap().to_one_hot(10);\n\n    let train_options = nn::TrainOptions::default().with_epochs(5).with_batch_size(256);\n    network.fit(\u0026x_train, \u0026y_train, train_options);\n\n    println!(\"loading test data...\");\n\n    let x_test = utils::loader::matrix_from_txt(\"data/test_x_10000x784_float32.txt\").unwrap().transform(|v: f64| v / 255.0);\n    let y_test = utils::loader::matrix_from_txt(\"data/test_y_10000_int32.txt\").unwrap().to_one_hot(10);\n\n    let predict_probs = network.predict_probs(\u0026x_test);\n    let loss = network.mean_loss_from_probs(\u0026predict_probs, \u0026y_test);\n    let accuracy = network.accuracy_from_probs(\u0026predict_probs, \u0026y_test);\n    println!(\"accuracy = {}, mean loss = {}\", accuracy, loss);\n}\n```\n\n## Progress\n\nOnly very few functions have been implemented yet.\nHelp is very welcome.\n\n### Layers\n\n- [x] Dense (missing bias)\n- [ ] Dropout\n- [ ] Convolutional\n\n### Activations\n\n- [x] ReLU\n- [x] sigmoid\n- [ ] tanh\n- [ ] softplus\n- [ ] softsign\n\n### Objectives\n\n- [x] Categorical Cross Entropy\n- [x] Binary Cross Entropy\n- [ ] Mean square\n- [ ] Poisson\n- [ ] KL divergence\n\n### Optimizers\n\n- [x] SGD\n- [ ] Adam\n- [ ] Adamax\n- [ ] RMSprop\n\n### Other\n\n- [ ] Serialization\n- [ ] Metrics\n- [ ] Layer configurations\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanhper%2Frust-simple-nn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanhper%2Frust-simple-nn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanhper%2Frust-simple-nn/lists"}