mnist-ready 1.0.1 → 1.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3b8f7fc1f5a021b575c6d8db4b572ff07f35b7cf38970a01f71c7f1b6b7a7b29
4
- data.tar.gz: bab03e221396b4665c22b9572a4ecaa7e083490618918141bb5d06560123318a
3
+ metadata.gz: 26aad87a0b6707728b05174ab07c06be005db76c48923f1547a572feaedb7073
4
+ data.tar.gz: 0f1c3a5cac7499aea7c75e8c1e07bbff00fcd022a1affb3da811331e3d87813d
5
5
  SHA512:
6
- metadata.gz: 7cba8a705e4d7fd003dca541b636627c512dc30213878cdc4b696a8f8e1b2335ec02661015695844a36a8040df02858e088fb2f9e0da9cf4eb9dc0ee3658d8f8
7
- data.tar.gz: 44f2bf8a067de706b647532e4a1fcd5c113aaff6888e9893cefc9064ffabcf815cc2673ab650fde97443bc32ff9d6daf4a2f2f6768f9e3e11153b435705db190
6
+ metadata.gz: 157ef554654e65b3dafe95a34c8a0bd5b90fb8f879f18575d3000c7435ccf9ebc668163280d5fd085793fb64198e6db236b0f01e02dbd1bfc2f002e823fe5cdf
7
+ data.tar.gz: 4464494c09a8d24f2b4c979bf602d452610e73402dbff2461863b9b52e1f5dabd669ea61868f1a681d5f73aa491d8381866317e56395cfa4c77055f8ac8f2ded
data/lib/mnist-ready.rb CHANGED
@@ -2,7 +2,7 @@ require_relative 'mnist_dataset.rb'
2
2
 
3
3
  =begin
4
4
 
5
- MNIST = MnistDataset.instance
5
+ MNIST = MnistDataset.instance(show_progress = true)
6
6
 
7
7
  # 70,000 digits in total
8
8
  puts MNIST.all_set.size # => 70000
data/lib/mnist_dataset.rb CHANGED
@@ -4,14 +4,14 @@ require 'json'
4
4
 
5
5
  class MnistDataset
6
6
 
7
- @@VERSION = "1.0.1"
7
+ @@VERSION = "1.0.2"
8
8
  @@YEAR = "2023"
9
9
 
10
10
  @instance_mutex = Mutex.new
11
11
 
12
12
  private_class_method :new
13
13
 
14
- def initialize
14
+ def initialize(show_progress)
15
15
  test_set = File.join(File.dirname(__FILE__), '..', 'data', 'mnist_test.csv')
16
16
 
17
17
  @train_set = []
@@ -23,6 +23,7 @@ class MnistDataset
23
23
  digit = MnistDigit.new(label, pixels)
24
24
  @test_set.push(digit)
25
25
  @all_set.push(digit)
26
+ print "\r#{all_set.size}" if show_progress
26
27
  end
27
28
 
28
29
  (1..3).each do |index|
@@ -32,17 +33,18 @@ class MnistDataset
32
33
  digit = MnistDigit.new(label, pixels)
33
34
  @train_set.push(digit)
34
35
  @all_set.push(digit)
36
+ print "\r#{all_set.size}" if show_progress
35
37
  end
36
38
  end
37
-
39
+ puts if show_progress
38
40
  end
39
41
 
40
42
  attr_reader :all_set, :train_set, :test_set
41
43
 
42
- def self.instance
44
+ def self.instance(show_progress = false)
43
45
  return @instance if @instance
44
46
  @instance_mutex.synchronize do
45
- @instance ||= new
47
+ @instance ||= new(show_progress)
46
48
  end
47
49
  @instance
48
50
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mnist-ready
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergio Oliveira Jr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-01 00:00:00.000000000 Z
11
+ date: 2023-03-02 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: sergio.oliveira.jr@gmail.com