File tree Expand file tree Collapse file tree 13 files changed +81
-46
lines changed
test/clojure_examples/test Expand file tree Collapse file tree 13 files changed +81
-46
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ /target
2+ /lib
3+ /classes
4+ /checkouts
5+ pom.xml
6+ pom.xml.asc
7+ * .jar
8+ * .class
9+ .lein-deps-sum
10+ .lein-failures
11+ .lein-plugins
12+ .lein-repl-history
Original file line number Diff line number Diff line change 1+ # neural_network example backpropagation netowrk
2+
3+ This will compile the Java source files in the directory ../../src/neuralnetworks and add them to the project.
4+
5+ Run with:
6+
7+ ~~~~~~~~
8+ lein test
9+ ~~~~~~~~
Original file line number Diff line number Diff line change 1+ (defproject neural_network " 0.1.0-SNAPSHOT"
2+ :description " FIXME: write description"
3+ :url " http://example.com/FIXME"
4+ :license {:name " Eclipse Public License"
5+ :url " http://www.eclipse.org/legal/epl-v10.html" }
6+ :dependencies [[org.clojure/clojure " 1.5.1" ]]
7+ ; ;:java-source [["../../src/neuralnetworks/Hopfield.java"]]
8+ :java-source-paths [" ../../src/neuralnetworks" ]
9+ )
Original file line number Diff line number Diff line change 1+ (ns neural-network.core )
2+
3+ (defn foo
4+ " I don't do a whole lot."
5+ [x]
6+ (println x " Hello, World!" ))
Original file line number Diff line number Diff line change 1+ (ns neural-network.core-test
2+ (:use clojure.test
3+ neural-network.core))
4+
5+ (import '(neuralnetworks.Neural_2H_momentum))
6+
7+ (def nn (neuralnetworks.Neural_2H_momentum. 3 3 3 3 0.2 ))
8+
9+ (println nn)
10+
11+ (def in1 (float-array [0.1 0.1 0.9 ]))
12+ (println in1)
13+
14+ (def in2 (float-array [0.1 0.9 0.1 ]))
15+ (def in3 (float-array [0.9 0.1 0.1 ]))
16+
17+ (def out1 (float-array [0.9 0.1 0.1 ]))
18+ (def out2 (float-array [0.1 0.1 0.9 ]))
19+ (def out3 (float-array [0.1 0.9 0.1 ]))
20+
21+ (def test1 (float-array [0.1 0.1 0.9 ]))
22+ (def test2 (float-array [0.1 0.9 0.1 ]))
23+ (def test3 (float-array [0.9 0.1 0.1 ]))
24+
25+ (.addTrainingExample nn in1 out1)
26+ (.addTrainingExample nn in2 out2)
27+ (.addTrainingExample nn in3 out3)
28+
29+ (doseq [i (range 300 )] (println (.train nn))) ; ; train net 300 cycles
30+
31+ ; ; test to make sure we have learned the input patterns:
32+
33+ (println (seq (.recall nn test1)))
34+ (println (seq (.recall nn test2)))
35+ (println (seq (.recall nn test3)))
36+
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments