File: simple_train.py

package info (click to toggle)
libfann 2.1.0~beta~dfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 14,616 kB
  • ctags: 915
  • sloc: sh: 8,712; ansic: 5,994; cpp: 2,351; makefile: 485; perl: 243; python: 133; sed: 7
file content (22 lines) | stat: -rwxr-xr-x 580 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/python
from pyfann import libfann

connection_rate = 1
learning_rate = 0.7
num_input = 2
num_neurons_hidden = 4
num_output = 1

desired_error = 0.0001
max_iterations = 100000
iterations_between_reports = 1000

ann = libfann.neural_net()
ann.create_sparse_array(connection_rate, (num_input, num_neurons_hidden, num_output))
ann.set_learning_rate(learning_rate)
ann.set_activation_function_output(libfann.SIGMOID_SYMMETRIC_STEPWISE)

ann.train_on_file("../../examples/xor.data", max_iterations, iterations_between_reports, desired_error)

ann.save("nets/xor_float.net")