class Mnist::MnistReader

Public Class Methods

new(base_path, one_hot = false) click to toggle source
# File lib/mnist-learn.rb, line 15
def initialize(base_path, one_hot = false)
  @base_path = base_path
  @one_hot = one_hot
end

Public Instance Methods

test() click to toggle source
# File lib/mnist-learn.rb, line 24
def test
  load_pair('t10k-images-idx3-ubyte', 't10k-labels-idx1-ubyte')
end
train() click to toggle source
# File lib/mnist-learn.rb, line 20
def train
  load_pair('train-images-idx3-ubyte', 'train-labels-idx1-ubyte')
end

Private Instance Methods

load_pair(images, labels) click to toggle source
# File lib/mnist-learn.rb, line 30
def load_pair(images, labels)
  Loader.new(File.join(@base_path, images), File.join(@base_path, labels), @one_hot)
end