class Rbmnist::MNIST::Test

Constants

CLEAN_IMAGE_COUNT
IMAGE_COUNT

Public Class Methods

clean_images() click to toggle source
# File lib/rbmnist/mnist.rb, line 44
def self.clean_images
    images[0...CLEAN_IMAGE_COUNT]
end
clean_labels() click to toggle source
# File lib/rbmnist/mnist.rb, line 48
def self.clean_labels
    labels[0...CLEAN_IMAGE_COUNT]
end
images() click to toggle source
# File lib/rbmnist/mnist.rb, line 33
def self.images
    if @@images.length == 0
        img_bytes = unzip_from_path(__dir__ + '/../../data/t10k-images-idx3-ubyte.gz')
        curr_byte = 16
        @@images = Array.new(IMAGE_COUNT) do |pic|
            Rbmnist::ImageWrapper.new(img_bytes[curr_byte...(curr_byte += 784)])
        end
    end
    @@images
end
labels() click to toggle source
# File lib/rbmnist/mnist.rb, line 52
def self.labels
    if @@labels.length == 0
        label_bytes = unzip_from_path(__dir__ + '/../../data/t10k-labels-idx1-ubyte.gz')
        curr_byte = 8
        @@labels = Array.new(IMAGE_COUNT) do |label|
            label_bytes[curr_byte...(curr_byte += 1)].first
        end
    end
    @@labels
end