rann 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/rann/backprop.rb +8 -5
- data/lib/rann/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d6d82c495eff427af738f4734993fd2611848b9
|
4
|
+
data.tar.gz: de50063a5696ae822b565ce61629f4474e237d78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 478e37a62c101eec3f8bc23125c308fb49f27257b80a119dea4747c481fe65f5d53397db7013cf4642e097ff81699471d4e6ff860720e2366fd90cf2760ca61a
|
7
|
+
data.tar.gz: 1a131eb754900d36f2353064cd8b05f1e179adbbee95e25063511a029636378490dff0b2f1bc7678a31027d0dbc6b0fee6bd20df14ef25ace465b6b31fff828e
|
data/lib/rann/backprop.rb
CHANGED
@@ -34,9 +34,12 @@ module RANN
|
|
34
34
|
avg_gradients = Hash.new{ |h, k| h[k] = 0 }
|
35
35
|
avg_batch_error = 0
|
36
36
|
|
37
|
-
# force longer bits of work per iteration, to maximise CPU usage
|
38
|
-
#
|
39
|
-
|
37
|
+
# force longer bits of work per iteration, to maximise CPU usage less
|
38
|
+
# marshalling data and process overhead etc. best for small networks. for
|
39
|
+
# larger networks where one unit of work takes a long time, and the work
|
40
|
+
# can vary in time taken, use num_groups == inputs.size
|
41
|
+
num_groups = opts[:num_groups] || ([1, opts[:processes]].max * 10)
|
42
|
+
grouped_inputs = in_groups(inputs, num_groups, false).reject &:empty?
|
40
43
|
reduce_proc =
|
41
44
|
lambda do |_, _, result|
|
42
45
|
group_avg_gradients, group_avg_error = result
|
@@ -110,8 +113,8 @@ module RANN
|
|
110
113
|
error = mse targets, outputs
|
111
114
|
|
112
115
|
# backward pass with unravelling for recurrent networks
|
113
|
-
node_deltas = Hash.new{ |h, k| h[k] = Hash.new
|
114
|
-
gradients = Hash.new
|
116
|
+
node_deltas = Hash.new{ |h, k| h[k] = Hash.new 0.to_d }
|
117
|
+
gradients = Hash.new 0.to_d
|
115
118
|
|
116
119
|
initial_timestep = inputs.size - 1
|
117
120
|
neuron_stack = network.output_neurons.map{ |n| [n, initial_timestep] }
|
data/lib/rann/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rann
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Campbell
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parallel
|