{"id":15437350,"url":"https://github.com/lucianbuzzo/gradnite","last_synced_at":"2025-03-28T06:23:56.384Z","repository":{"id":182994838,"uuid":"669121299","full_name":"LucianBuzzo/gradnite","owner":"LucianBuzzo","description":"A simple Autograd engine written in Crystal","archived":false,"fork":false,"pushed_at":"2023-08-05T14:55:12.000Z","size":5969,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-18T10:30:56.437Z","etag":null,"topics":["autograd","crystal","neural-network"],"latest_commit_sha":null,"homepage":"","language":"Crystal","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/LucianBuzzo.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-21T11:49:13.000Z","updated_at":"2023-07-23T12:06:06.000Z","dependencies_parsed_at":"2024-12-07T10:34:11.742Z","dependency_job_id":null,"html_url":"https://github.com/LucianBuzzo/gradnite","commit_stats":{"total_commits":13,"total_committers":1,"mean_commits":13.0,"dds":0.0,"last_synced_commit":"00819109070273295097185b10fa4c848e5314c4"},"previous_names":["lucianbuzzo/gradnite"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LucianBuzzo%2Fgradnite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LucianBuzzo%2Fgradnite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LucianBuzzo%2Fgradnite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LucianBuzzo%2Fgradnite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LucianBuzzo","download_url":"https://codeload.github.com/LucianBuzzo/gradnite/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245980025,"owners_count":20704047,"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":["autograd","crystal","neural-network"],"created_at":"2024-10-01T18:56:28.198Z","updated_at":"2025-03-28T06:23:56.365Z","avatar_url":"https://github.com/LucianBuzzo.png","language":"Crystal","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n![Gradnite](assets/gradnite-banner-light.png#gh-light-mode-only)\n![Gradnite](assets/gradnite-banner-dark.png#gh-dark-mode-only)\n\n\u003cp\u003e\n    \u003cstrong\u003eA simple Autograd engine written in Crystal.\u003c/strong\n\u003c/p\u003e\n\n\u003c/div\u003e\n\n## Usage\n\nAdd Gradnite to your `shard.yml` and run `shards install`:\n\n```yaml\ndependencies:\n  gradnite:\n    github: lucianbuzzo/gradnite\n    version: 0.1.0\n```\n\nYou can now require the module and use it's classes:\n\n```crystal\n# require the gradnite module\nrequire \"gradnite\"\n\n# create a new Node\nnode = Gradnite::Node.new(1.0)\n\n# add two nodes together\nnode = Gradnite::Node.new(1.0) + Gradnite::Node.new(2.0)\n\n# multiply two nodes together\nnode = Gradnite::Node.new(1.0) * Gradnite::Node.new(2.0)\n\n# divide two nodes together\nnode = Gradnite::Node.new(1.0) / Gradnite::Node.new(2.0)\n\n# create a Neuron with 4 inputes\nneuron = Gradnite::Neuron.new(4)\n\n# create an MLP with 2 inputs, 2 hidden layers of 3 neurons each and 1 output\nmlp = Gradnite::MLP.new(2, [3, 3, 1])\n\n# run a forward pass on the mlp\nmlp.forward([1.0, 2.0])\n\n# run back propagation on the mlp\nmlp.backward\n\n# update the weights of the mlp\nmlp.parameters.each { |p|\n    p.value += -0.1 * p.grad\n}\n```\n\nGradnite also includes a utility for visualizing the computation graph of a neural network using `graphviz`. To use it, make sure you have `graphviz` installed locally and call the `draw_dot` function with a node:\n\n```crystal\na = Gradnite::Node.new value: 1.0, label: \"a\"\nb = Gradnite::Node.new value: 2.0, label: \"b\"\nc = a * b\nc.label = \"c\"\n\nGradnite::draw_dot(c, \"examples/multiply.dot\")\n```\n\nYou can now generate a png image of the computation graph using the `dot` command:\n\n```bash\ndot -Tpng examples/multiply.dot -o examples/multiply.png\n```\n\nFor more examples of usage see the [examples](examples) directory.\n\n## Development\n\nInstall prerequisites:\n\n```bash\nbrew install crystal watchexec graphviz\n```\n\nRun in watch mode:\n\n```bash\n./watch.sh examples/binary_classifier.cr\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucianbuzzo%2Fgradnite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flucianbuzzo%2Fgradnite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucianbuzzo%2Fgradnite/lists"}