mnist-learn 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mnist-learn.rb +18 -1
- data/lib/mnist-learn/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7c32173c9b2cad0727cad6c42fbcbe2e26ee018
|
4
|
+
data.tar.gz: fa38db0274728e2c9cc8e485df204170e7975314
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e5d3ae3edf48bbf64d435d13f779373c164cbe5e657dabeec37ce365251aa159f8298697bbd48cb05dd81d6440772fd7e7a411ebf5fb1495f064ebd0aea8a54
|
7
|
+
data.tar.gz: 389b4d54998861186d77fba7772fdde0ff29a284ad011ef7f4a167fc8e8a61bddeea1fb06d42a5d6630a49b98469d5f1a5bdefffa3e9b19f64a8e7e42bea4686
|
data/lib/mnist-learn.rb
CHANGED
@@ -69,7 +69,7 @@ module Mnist
|
|
69
69
|
@all_labels ||= (@one_hot ? load_labels.map { |label_data| one_hot_transform(label_data) } : load_labels)
|
70
70
|
end
|
71
71
|
|
72
|
-
def
|
72
|
+
def next(batch_size)
|
73
73
|
if @index == 0
|
74
74
|
@rows, @columns, @images = load_images
|
75
75
|
@labels = load_labels
|
@@ -87,6 +87,23 @@ module Mnist
|
|
87
87
|
end
|
88
88
|
[images, labels]
|
89
89
|
end
|
90
|
+
|
91
|
+
def next_batch(batch_size, rnd: Random.new)
|
92
|
+
@data_set ||= begin
|
93
|
+
rows, columns, images = load_images
|
94
|
+
labels = load_labels
|
95
|
+
Array.new(images.size) do
|
96
|
+
image_data = images[@index]
|
97
|
+
label_data = labels[@index]
|
98
|
+
image_data.map! { |b| b.to_f / 255.0 }
|
99
|
+
@index += 1
|
100
|
+
[image_data, (@one_hot ? one_hot_transform(label_data) : label_data.to_f)]
|
101
|
+
end
|
102
|
+
end
|
103
|
+
@data_set.shuffle!(random: rnd)
|
104
|
+
batch = @data_set[0...batch_size]
|
105
|
+
[batch.map { |v| v[0]}, batch.map { |v| v[1]}]
|
106
|
+
end
|
90
107
|
|
91
108
|
private
|
92
109
|
|
data/lib/mnist-learn/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mnist-learn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joseph Dayo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
122
|
version: '0'
|
123
123
|
requirements: []
|
124
124
|
rubyforge_project:
|
125
|
-
rubygems_version: 2.
|
125
|
+
rubygems_version: 2.2.2
|
126
126
|
signing_key:
|
127
127
|
specification_version: 4
|
128
128
|
summary: Utilities for MNIST handwritten digits data
|