{"id":32184884,"url":"https://github.com/japonophile/synaptic","last_synced_at":"2026-02-22T10:37:46.023Z","repository":{"id":18386887,"uuid":"21567896","full_name":"japonophile/synaptic","owner":"japonophile","description":"Neural Networks in Clojure","archived":false,"fork":false,"pushed_at":"2016-02-02T13:19:00.000Z","size":3613,"stargazers_count":88,"open_issues_count":5,"forks_count":11,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-10-21T23:59:18.287Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/japonophile.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}},"created_at":"2014-07-07T11:16:42.000Z","updated_at":"2023-05-09T14:08:26.000Z","dependencies_parsed_at":"2022-08-28T15:30:51.792Z","dependency_job_id":null,"html_url":"https://github.com/japonophile/synaptic","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/japonophile/synaptic","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/japonophile%2Fsynaptic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/japonophile%2Fsynaptic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/japonophile%2Fsynaptic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/japonophile%2Fsynaptic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/japonophile","download_url":"https://codeload.github.com/japonophile/synaptic/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/japonophile%2Fsynaptic/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29709497,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-22T10:34:24.778Z","status":"ssl_error","status_checked_at":"2026-02-22T10:32:23.200Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2025-10-21T23:59:15.754Z","updated_at":"2026-02-22T10:37:45.955Z","avatar_url":"https://github.com/japonophile.png","language":"Clojure","funding_links":[],"categories":["Machine Learning"],"sub_categories":[],"readme":"# synaptic\n\n[Synaptic](http://chopp.in/clj/synaptic/) is a Neural Networks library written in Clojure.\n\nIt is intendend to be used for experimenting with various neural network\narchitectures and learning algorithms, as well as to solve real-life\nproblems.\n\nIt is largely inspired by Geoffrey Hinton's class \"Neural Networks\nfor Machine Learning\" available online on\n[Coursera](https://class.coursera.org/neuralnets-2012-001).\n\n## Features\n\nSynaptic allows to create multilayer feedforward networks and train them\nusing various algorithms such as:\n- perceptron learning rule\n- backpropagation\n- L-BFGS (approximation of Newton's method)\n- R-prop\n- RMSprop\n- L1 \u0026 L2 regularization\n- convolution / pooling layers\n\nIt also allows to play with various training parameters like learning\nrate and momentum, and supports adaptive learning rate and variants of\nthe momentum method (Nesterov's momentum).\n\n## Usage\n\nTo use Synaptic, first add this to your `project.clj`:\n\n[![Clojars Project](http://clojars.org/synaptic/latest-version.svg)](http://clojars.org/synaptic)\n\nYou can then experiment in the REPL.\n\nFirst, make sure you have a directory called `data` in your project, where you copy the \ntraining set (you can use the mnist10k training set provided in Synaptic git repo).\n\n```\n$ ls data/\ndata/trainingset.mnist10k\n```\n\nNext, open your REPL, load the training set and create a neural net, as follows:\n\n```clojure\n(require '[synaptic.core :refer :all])\n\n(def trset (load-training-set \"mnist10k\"))   ; load MNIST training set\n(def net (mlp [784 100 10]             ; net with 784 inputs, 100 hidden units\n              [:sigmoid :softmax]      ; and 10 (softmax) outputs\n              (training :backprop)))   ; to be trained with backpropagation\n\n(train net trset 10)              ; train the network for 10 epochs (returns a future)\n@*1                               ; (deref to wait for the future to complete)\n\n(-\u003e @net :training :stats)        ; show training statistics\n```\n\nNote: you may want to do `export JVM_OPTS=\"-Xmx1024m\"` before starting your\nREPL to make sure you have enough memory to load the training set.\n\nSynaptic github repository includes a subset of the\n[MNIST handwritten digit](http://yann.lecun.com/exdb/mnist/)\ntraining data available on Yann LeCun's website, so you can experiment.\n\nBut you can also easily create your own training set:\n\n```clojure\n(def trset (training-set samples labels))\n```\n\nThere are many options you can specify to customize the training algorithm to\nyour taste.\n\n## Examples\n\n```clojure\n(require '[synaptic.core :refer :all])\n\n(def trset (load-training-set \"mnist10k\"))\n```\n\n- Classic perceptron (has only 1 layer and uses misclassification cost function \ninstead of cross-entropy).\n\n```clojure\n(def net (mlp [784 10] :binary-threshold (training :perceptron)))\n```\n\n- Multi-layer perceptron with 784 input units, 100 hidden units, and 10 output units.  Initialize backpropagation training with a learning rate of 0.001:\n\n```clojure\n(def net (mlp [784 100 10] [:sigmoid :softmax]\n              (training :backprop {:learning-rate {:epsilon 0.001}})))\n```\n\n- Neural net with an input layer of 28x28 fields, a convolution layer with 3 9x9 fieldmaps and 2x2 pooling, and a fully connected layer with 10 output units.\n\n```clojure\n(def net (neural-net [{:type :input :fieldsize [28 28]}\n                      {:type :convolution :act-fn :hyperbolic-tangent\n                       :feature-map {:size [9 9] :k 3}\n                       :pool {:kind :max :size [2 2]}}\n                      {:type :fully-connected :act-fn :sigmoid :n 10}]\n                     (training :backprop {:learning-rate {:epsilon 0.01}})))\n```\n\n- Specify adaptive learning rate with min and max gain of 0.01 and 10.0:\n\n```clojure\n(def net (mlp [784 100 10] [:sigmoid :softmax]\n              (training :backprop\n              {:learning-rate {:epsilon 0.01 :adaptive true\n                               :ming 0.01 :maxg 10.0}})))\n```\n\n- Use L-BFGS unconstrained optimization algorithm instead of backprop:\n\n```clojure\n(def net (mlp [784 100 10] [:sigmoid :softmax] (training :lbfgs)))\n```\n\n## How to monitor training\n\nAs mentioned above, the `train` function returns a future which will be\ncompleted when the training stops.  You can monitor the training by adding\na watch on the `net` (it is an atom) so you can see when its weights change\nor when training state or training stats are updated (typically every epoch).\n\n## To Do\n\n- Implement other regularization techniques, such as weight decay\n\n- Support other kind of neural networks, such as RNN or RBM\n\n## Feedback\n\nThis library is still in its infancy.\nYour feedback on how it can be improved, and contributions are welcome.\n\n## License\n\nCopyright © 2014-2015 Antoine Choppin\n\nDistributed under the Eclipse Public License, the same as Clojure.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaponophile%2Fsynaptic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaponophile%2Fsynaptic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaponophile%2Fsynaptic/lists"}