-
Notifications
You must be signed in to change notification settings - Fork 3
/
run.py
48 lines (38 loc) · 1.06 KB
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import annlib.lib.config as config
import annlib.generator as generator
import annlib.case as case
#
# Use this file to load cases, create and train networks.
#
# * Create a casefile in the 'cases' folder
# * Use a script from the 'scripts' folder
# * The finished network is saved in the 'networks' folder.
#
# Select case
casename = 'avoidance'
###########################################################
# Load case
print 'Loading case', casename
case = case.Case(casename)
# Directory of the ANN library
config.base_dir = 'annlib/'
# Generate case ANN
print 'Generating ANN for', casename
ann = generator.Generator.generate_ann(case)
# Run the case
print 'Running case', casename
output = case.run(ann)
# Report testing results
if case.tasks and case.tasks[-1].is_testing():
print 'Testing network:'
print 'given input'
print case.tasks[-1].input()
print 'expected output'
print case.tasks[-1].output()
print 'actual output'
print output
# Display weights
#for layer in ann.layers:
# layer.draw_links()
# Save network
ann.save(casename)