Class: Datasets::MNIST::Record

Inherits:
Struct
  • Object
show all
Defined in:
lib/datasets/mnist.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#dataObject

Returns the value of attribute data

Returns:

  • (Object)

    the current value of data



9
10
11
# File 'lib/datasets/mnist.rb', line 9

def data
  @data
end

#labelObject

Returns the value of attribute label

Returns:

  • (Object)

    the current value of label



9
10
11
# File 'lib/datasets/mnist.rb', line 9

def label
  @label
end

Instance Method Details

#pixelsObject



10
11
12
# File 'lib/datasets/mnist.rb', line 10

def pixels
  data.unpack("C*")
end

#to_hObject



14
15
16
17
18
# File 'lib/datasets/mnist.rb', line 14

def to_h
  hash = super
  hash[:pixels] = pixels
  hash
end