• Stars
    star
    104
  • Rank 330,604 (Top 7 %)
  • Language
    Clojure
  • Created about 11 years ago
  • Updated almost 10 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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 Repositories

1

wonderland-clojure-katas

Clojure Katas inspired by Alice in Wonderland
Clojure
867
star
2

clj-drone

Clojure Copter - Control for the AR Parrot Drone
Clojure
238
star
3

libpython-clj-examples

Examples using libpython-clj
Clojure
142
star
4

babar

A little language for machines with speech acts
Clojure
109
star
5

chemical-computing

Explorations in chemical computing with Clojure
Clojure
93
star
6

clojure-mxnet

Clojure Package for MXNET
69
star
7

kaggle-cats-dogs

Kaggle Challenge of Cats and Dogs Recognition
Clojure
62
star
8

cats-dogs-cortex-redux

Kaggle Cats & Dogs Redux with Cortex and Resnet50
Jupyter Notebook
58
star
9

vsa-clj

VSA Computing Experiments in Clojure
Clojure
56
star
10

markov-elear

Markov Edward Lear Nonsense Poems + Functional Programming
Clojure
45
star
11

genetic-programming-spec

Experiment to use genetic programming to generate clojure.spec programs from test data
Clojure
42
star
12

yellow_belt_clojure_katas

Beginner Katas Project Setup Using Midje
Clojure
36
star
13

speech-acts-classifier

Speech act classifier for text based on Stanford CoreNLP and Weka
Clojure
34
star
14

graal-test

Explorations with GraalVM and Clojure
Clojure
33
star
15

eodermdrome

An experimental esolang implementation of a Kolmogorov-Uspensky machine
Clojure
28
star
16

hyperdimensional-playground

An exploration of hypervectors and word vectors
Clojure
26
star
17

self-healing

Experiment with self healing code and clojure.spec
Clojure
25
star
18

clj-roomba

Sample project to control your Roomba with the Clojure REPL
Clojure
20
star
19

colab-iclojure

Examples of How to Use Google Colaboratory with IClojure
Jupyter Notebook
18
star
20

jruby_semantic_web_examples

Examples for Accessing Jena API through JRuby
Ruby
17
star
21

stanford-talk

Clojure text parser with annotations using Stanford CoreNLP
Clojure
17
star
22

yellow_belt_ruby_katas

Beginner Katas Project Setup Using rpsec-given
Ruby
14
star
23

mxnet-gan-flan

An Example of using GANs with Flans
Clojure
8
star
24

hitchhikers-clojure

Part Clojure tutorial - part fanfiction - inspired from a questionable amount of cheese
CSS
7
star
25

baba-yaga-reducers

Sample project to explore Clojure Reducers
Clojure
7
star
26

star-lang-katas

Katas exploring the Star Programming Language
Emacs Lisp
6
star
27

clj-hexapod

Clojure Control Library for the PhantomX Hexapod
Clojure
6
star
28

dichotomous_key

Dichotomous Key
JavaScript
6
star
29

strangeloop-dance-party

Strange Loop Dance Party Code
Clojure
5
star
30

mxnet-datafy

Experiments with Datafy, MXNet, and REBL
Clojure
5
star
31

Presentations

Presentations
4
star
32

sphero-playground

A jump start to playing with Sphero & Clojure
Clojure
4
star
33

oscon-solve-concurrency

Exercises and Examples for OSCON Workshop
Clojure
3
star
34

robot-dance-party

Robots Dance party with Overtone
Clojure
3
star
35

gigasquid.github.io

Blog
HTML
3
star
36

clojure-mxnet-autoencoder

clojure-mxnet-autoencoder
Clojure
3
star
37

cheshire-cat

Example for Living Clojure
JavaScript
2
star
38

roomba-dreams

Experiments with D3 and @SelfAwareROOMBA
JavaScript
2
star
39

roomba-drone-friends

Roomba and AR Drone are Friends
Clojure
1
star
40

figwheel-dots

Experiments with Figwheel and dots
Clojure
1
star
41

ring-twitter-common

A Clojure Web App on Heroku Cedar for finding Twitter Users in Common
JavaScript
1
star
42

libpython-clj-uberjar-test

test repo
Clojure
1
star
43

clojure-twitter-in-common

Small Clojure project using clojure-twitter, oAuth and Midje
Clojure
1
star