{"id":30620298,"url":"https://github.com/GrgoMariani/mmnnrust","last_synced_at":"2025-08-30T13:10:33.199Z","repository":{"id":287225103,"uuid":"964022769","full_name":"GrgoMariani/mmnnrust","owner":"GrgoMariani","description":"rust-based bash-cli for Neural Network propagation/backpropagation","archived":false,"fork":false,"pushed_at":"2025-06-28T06:06:45.000Z","size":39,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-15T21:41:50.145Z","etag":null,"topics":["backpropagation","cli","json","network","neural","propagation","rust"],"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/GrgoMariani.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,"zenodo":null}},"created_at":"2025-04-10T15:12:37.000Z","updated_at":"2025-06-28T06:06:48.000Z","dependencies_parsed_at":"2025-04-11T01:54:48.956Z","dependency_job_id":"78e26245-b886-4255-91b8-79a51e04962f","html_url":"https://github.com/GrgoMariani/mmnnrust","commit_stats":null,"previous_names":["grgomariani/mmnnrust"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/GrgoMariani/mmnnrust","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrgoMariani%2Fmmnnrust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrgoMariani%2Fmmnnrust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrgoMariani%2Fmmnnrust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrgoMariani%2Fmmnnrust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GrgoMariani","download_url":"https://codeload.github.com/GrgoMariani/mmnnrust/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrgoMariani%2Fmmnnrust/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272853119,"owners_count":25004203,"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","status":"online","status_checked_at":"2025-08-30T02:00:09.474Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["backpropagation","cli","json","network","neural","propagation","rust"],"created_at":"2025-08-30T13:10:25.623Z","updated_at":"2025-08-30T13:10:33.189Z","avatar_url":"https://github.com/GrgoMariani.png","language":"Rust","funding_links":[],"categories":["Neural Networks"],"sub_categories":[],"readme":"# mmnn - Micro Managed Neural Network\n\n[![Crates.io](https://img.shields.io/crates/v/mmnn)](https://crates.io/crates/mmnn)\n[![License](https://img.shields.io/badge/license-MIT%2FApache--2.0-blue.svg)](LICENSE)\n[![Rust](https://img.shields.io/badge/rust-1.70%2B-blue.svg)](https://www.rust-lang.org)\n\nA minimalist, flexible Neural Network CLI tool written in Rust that gives you precise control over neuron connections.\n\n# Table of Contents\n\n1. [Introduction](#introduction) \n2. [Getting Started](#getting-started)\n   - [Prerequisites](#prerequisites)\n   - [Installation](#installation)\n3. [Features](#features)\n4. [Usage](#usage)\n   - [Basic Usage](#basic-usage)\n   - [Advanced Usage](#advanced-usage)\n5. [Examples](#examples)\n6. [Contributing](#contributing)\n7. [License](#license)\n\n## Introduction\n\n**mmnn** (Micro Managed Neural Network) is a command-line tool that lets you design and experiment with neural networks using a simple JSON configuration format. Key benefits include:\n\n- Fine-grained control over individual neuron connections\n- Support for recursive neural networks\n- Easy integration with shell scripts via stdin/stdout\n- Minimal dependencies and lightweight design\n\nTake, for example, the following neural network, which is possible to be defined, propagated and trained with **mmnn**.\n\n```mermaid\n---\nconfig:\n  look: handDrawn\n---\nstateDiagram-v2\ndirection LR\nclassDef inputNeuron fill:#d7ece9,color:#000,font-weight:bold,stroke-width:2px,stroke:yellow\nclassDef outputNeuron fill:#cf388d,color:white,font-weight:bold,stroke-width:2px,stroke:yellow\nstate \"INPUT1\" as i1\nstate \"INPUT2\" as i2\nstate \"INPUT3\" as i3\nstate \"INPUT4\" as i4\nstate \"A\" as a\nstate \"B\" as b\nstate \"C\" as c\nstate \"D\" as d\nstate \"OUTPUT1\" as o1\nstate \"OUTPUT2\" as o2\n    i1 --\u003e a: 3.2\n    i2 --\u003e b: 2.4\n    i2 --\u003e c: -2.3\n    i3 --\u003e b: 1.2\n    i4 --\u003e c: -4.2\n    a --\u003e d: 4.3\n    b --\u003e d: 7.1\n    c --\u003e d: 1.55\n    i1 --\u003e d: 0.2\n    b --\u003e o1: -1.26\n    d --\u003e o1: 3.2\n    c --\u003e o2: 0.58\n    b --\u003e o2: -8.4\n    i4 --\u003e o1: 0.92\n\nclass i1 inputNeuron\nclass i2 inputNeuron\nclass i3 inputNeuron\nclass i4 inputNeuron\nclass o1 outputNeuron\nclass o2 outputNeuron\n\n```\n\n## Getting Started\n\n### Prerequisites\n\nBefore you begin, ensure you have met the following requirements:\n\n- Rust 1.70 or later\n- Cargo package manager\n- Basic understanding of neural networks\n- (Optional) Basic shell scripting knowledge\n\n### Installation\n\nYou can choose between two options:\n\n\u003ctable\u003e\n\u003ctr\u003e \u003ctd\u003e \u003cb\u003eInstall cargo\u003c/b\u003e \u003c/td\u003e\n\u003ctd\u003e \u003cb\u003eBuild Manually\u003c/b\u003e \u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\n\n```bash\n$ cargo install mmnn\n$ mmnn --help\n```\n\n\u003c/td\u003e\n\u003ctd\u003e\n\n```bash\n$ git clone git@github.com:GrgoMariani/mmnnrust\n$ cd mmnnrust\n$ cargo run -- --help\n```\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n## Features\n\n* JSON configuration\n* Forward propagation\n* Backward propagation\n* Recursive connections between neurons possible (more on that later)\n* Activations\n  * Identity\n  * ArcTan\n  * Binary\n  * ISRU\n  * LeakyReLU\n  * Linear\n  * ReLU\n  * ELU\n  * GELU\n  * Gaussian\n  * SoftSign\n  * SoftStep/Sigmoid\n  * TanH\n  * Swish\n  * Sinusoid\n  * ELiSH\n\n## Usage\n\n### Basic Usage\n\nTake this network for example:\n\n```mermaid\n---\nconfig:\n  look: handDrawn\n---\nstateDiagram-v2\ndirection LR\nstate \"INPUT\" as i1\nstate \"OUTPUT (ReLU)\" as o1\nstate \"bias\" as b\n    i1 --\u003e o1: 3.2\n    b --\u003e o1: 0.21\n```\n\nThis network consists of only one input neuron, one output neuron and a bias.\n\nThe equivalent configuration mmnn would use for this would be:\n\n```json\n{\n    \"inputs\": [\"INPUT\"],\n    \"outputs\": [\"OUTPUT\"],\n    \"neurons\": {\n        \"OUTPUT\": {\n            \"bias\": 0.21,\n            \"activation\": \"ReLU\",\n            \"synapses\": {\n                \"INPUT\": 3.2\n            }\n        }\n    }\n}\n```\n\n\u003e INFO: Notice how the synapses are defined right-to-left. i.e. previous neuron results are arguments for the next neuron.\n\nIf we save this configuration as **config.json** we could propagate it like so:\n```bash\n$ mmnn propagate config.json\nstdin  \u003e 1\nstdout \u003e 3.41\nstdin  \u003e 2\nstdout \u003e 6.61\n```\n\nThe propagation is done through the standard input where each line represents input values to the neurons.\n\nRead the rest of this README for more configuration examples.\n\n### Advanced Usage\n\nHere is a simple [Flip Flop](https://en.wikipedia.org/wiki/Flip-flop_(electronics))-like neural network which makes use of recursive neuron connections.\n```mermaid\n---\nconfig:\n  look: handDrawn\n---\nstateDiagram-v2\ndirection LR\nclassDef inputNeuron fill:#d7ece9,color:#000,font-weight:bold,stroke-width:2px,stroke:yellow\nclassDef outputNeuron fill:#cf388d,color:white,font-weight:bold,stroke-width:2px,stroke:yellow\nstate \"INPUT 1\" as i1\nstate \"INPUT 2\" as i2\nstate \"OUTPUT Q\n(ReLU)\" as o1\nstate \"OUTPUT !Q\n(ReLU)\" as o2\nstate \"bias\" as b\n    i1 --\u003e o1: -1\n    i2 --\u003e o2: -1\n    o1 --\u003e o2: -1\n    o2 --\u003e o1: -1\n    b --\u003e o1: 1\n    b --\u003e o2: 1\nclass i1 inputNeuron\nclass i2 inputNeuron\nclass o1 outputNeuron\nclass o2 outputNeuron\n```\n\n```bash\n$ mmnn propagate \u003c(cat \u003c\u003c-EOL\n    {\n        \"inputs\": [\"i1\", \"i2\"],\n        \"outputs\": [\"Q\", \"!Q\"],\n        \"neurons\": {\n            \"Q\": {\n                \"bias\": 1,\n                \"activation\": \"ReLU\",\n                \"synapses\": {\n                    \"!Q\": -1,\n                    \"i1\": -1\n                }\n            },\n            \"!Q\": {\n                \"bias\": 1,\n                \"activation\": \"ReLU\",\n                \"synapses\": {\n                    \"Q\": -1,\n                    \"i2\": -1\n                }\n            }\n        }\n    }\nEOL\n)\n```\n\nPlaying around with the input values should showcase how memory value of this circuit/network is retained.\n\n## Examples\n\nBy design this cargo package is a bash command line interface so bash can be utilized in full to create your propagation/training data.\n\nFor example:\n\n```bash\n#!/bin/bash\n\nfunction create_training_data() {\n    local iterations=\"${1}\"\n    local i1 i2 AND OR NOR\n    for ((i=0; i\u003citerations; i++)); do\n        i1=$((RANDOM%2))\n        i2=$((RANDOM%2))\n        AND=$((i1 \u0026 i2))\n        OR=$((i1 | i2))\n        NOR=$((!i1 \u0026 !i2))\n        # odd lines for forward propagation\n        echo \"${i1} ${i2}\"\n        # even lines for backpropagation\n        echo \"${AND} ${OR} ${NOR}\"\n    done\n}\n\nTRAIN_DATA_FILE=$(mktemp)\n\necho \"Creating the training data\"\ncreate_training_data 200000 \u003e \"${TRAIN_DATA_FILE}\"\n\n# train the model\necho \"Training the model\"\ncat \"${TRAIN_DATA_FILE}\" | mmnn learn \u003c(cat \u003c\u003c-EOL\n    {\n        \"inputs\": [\"i1\", \"i2\"],\n        \"outputs\": [\"AND\", \"OR\", \"NOR\"],\n        \"neurons\": {\n            \"AND\": {\n                \"bias\": 0.5,\n                \"activation\": \"relu\",\n                \"synapses\": {\n                    \"i1\": 1,\n                    \"i2\": 3\n                }\n            },\n            \"OR\": {\n                \"bias\": 2,\n                \"activation\": \"relu\",\n                \"synapses\": {\n                    \"i1\": 3.2,\n                    \"i2\": -1\n                }\n            },\n            \"NOR\": {\n                \"bias\": 1,\n                \"activation\": \"relu\",\n                \"synapses\": {\n                    \"i1\": 2.2,\n                    \"i2\": -1.1\n                }\n            }\n        }\n    }\nEOL\n) config_save.json --learning-rate 0.05\necho \"Learning done!\"\n# try the saved model\nmmnn propagate config_save.json\n```\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.\n\nPlease make sure to update tests as appropriate.\n\n## License\n\nLicensed under either of:\n\n- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n\n### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be dual licensed as above, without any additional terms or conditions.\n\nHave fun playing around with this tool!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGrgoMariani%2Fmmnnrust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FGrgoMariani%2Fmmnnrust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGrgoMariani%2Fmmnnrust/lists"}