ProductPromotion
Logo

Clojure

made by https://0x3d.site

GitHub - gigasquid/k9: Small library for using neural networks and core.matrix
Small library for using neural networks and core.matrix - gigasquid/k9
Visit Site

GitHub - gigasquid/k9: Small library for using neural networks and core.matrix

GitHub - gigasquid/k9: Small library for using neural networks and core.matrix

k9

A small library using core.matrix to construct Neural Networks

Usage

Construct simple 3 layer networks with

(construct-network n-inputs n-hiddens n-ouputs)

Example

(construct-network 2 3 2)
;=> [ [0 0] [input-to-hidden-strengths] [0 0 0] [hidden-to-output-strengths] [0 0]]

Feed foward input and get back output neuron values with

(ff input network)

Example

(ff [1 0] (construct-network 2 3 2));=>[0.023969361623158485 0.014886788800864243]

Train the network on data in the form of [[input target] [input target] ... ] => returns a new network

(train-data network data learning-rate)

Example

(def nn (construct-network 2 3 2))
#'user/nn
;; without training
(ff [1 0] nn) ;=> [0.03061049829949632 0.043037351551821625]
(def n1 (train-data nn  [
                         [[1 0] [0 1]]
                         [[0.5 0] [0 0.5]]
                         [[0.25 0] [0 0.25]]]
                     0.2))
(ff [1 0] n1) 
;=> [0.0383350329723964 0.06845383345543034]

Another example

(defn inverse-data []
  (let [n (rand 1)]
    [[n 0] [0 n]]))

(def n3 (train-data nn (repeatedly 400 inverse-data) 0.5))

(ff [1 0] n3) ;=> [-3.0872502374300364E-4 0.8334331107408276]

Can also train the network repeatedly on a set of data for "epochs"

(train-epochs n network training-data learning-rate)

Example

(def n4 (train-epochs 5 nn (repeatedly 200 inverse-data) 0.2))
(ff [1 0] n4) ;=> [-3.794899940782748E-4 0.8105184486966243

Example with Colors

There is another example in the examples directory where the network learns to name colors based on their rgb value.

Blog Post

I made a blog post about making a simple neural network with an example here: Blog

License

Copyright © 2013 Carin Meier

Distributed under the Eclipse Public License, the same as Clojure

More Resources
to explore the angular.

mail [email protected] to add your project or resources here 🔥.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory