nn 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/document.txt +1 -0
- data/lib/nn.rb +5 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a22a2db0abf0ff95fda30fcfdc92ec12847bd033b544cdb87ce007f69cb9f760
|
4
|
+
data.tar.gz: 91528c11fa35c99e0a3b0d84b863266a0107e810d8493d0489f6c7c372483fbe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6cf94cf86c9c0e160f369466a146b18b5114bafff755ed6ff4cb88a98898727fb67a94ce04a117b3d90761028be57777e7fb7effdca01a023586ba6a84cd1f1
|
7
|
+
data.tar.gz: 27cf471cece4749dea22e2a470d5e342fd33de689ff38191cfc0445a6df3655b0da5f91552766fbd2db10e0ba3bd7a17997a863a2811db2b937bddaea5dc5a60
|
data/document.txt
CHANGED
data/lib/nn.rb
CHANGED
@@ -2,7 +2,7 @@ require "numo/narray"
|
|
2
2
|
require "json"
|
3
3
|
|
4
4
|
class NN
|
5
|
-
VERSION = "2.
|
5
|
+
VERSION = "2.2"
|
6
6
|
|
7
7
|
include Numo
|
8
8
|
|
@@ -297,13 +297,12 @@ class NN::Affine
|
|
297
297
|
end
|
298
298
|
|
299
299
|
def backward(dout)
|
300
|
-
|
301
|
-
@d_weight = x.dot(dout.reshape(dout.shape[0], 1, dout.shape[1])).mean(0)
|
300
|
+
@d_weight = @x.transpose.dot(dout)
|
302
301
|
if @nn.weight_decay > 0
|
303
302
|
dridge = @nn.weight_decay * @nn.weights[@index]
|
304
303
|
@d_weight += dridge
|
305
304
|
end
|
306
|
-
@d_bias = dout.
|
305
|
+
@d_bias = dout.sum(0)
|
307
306
|
dout.dot(@nn.weights[@index].transpose)
|
308
307
|
end
|
309
308
|
end
|
@@ -347,7 +346,7 @@ class NN::Identity
|
|
347
346
|
end
|
348
347
|
|
349
348
|
def backward(y)
|
350
|
-
@out - y
|
349
|
+
(@out - y) / @nn.batch_size
|
351
350
|
end
|
352
351
|
|
353
352
|
def loss(y)
|
@@ -369,7 +368,7 @@ class NN::Softmax
|
|
369
368
|
end
|
370
369
|
|
371
370
|
def backward(y)
|
372
|
-
@out - y
|
371
|
+
(@out - y) / @nn.batch_size
|
373
372
|
end
|
374
373
|
|
375
374
|
def loss(y)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- unagiootoro
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-06-
|
11
|
+
date: 2018-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: numo-narray
|