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

#data ⇒ Object

Returns the value of attribute data

Returns:

  • (Object) —

    the current value of data



7
8
9
# File 'lib/datasets/mnist.rb', line 7

def data
  @data
end

#label ⇒ Object

Returns the value of attribute label

Returns:

  • (Object) —

    the current value of label



7
8
9
# File 'lib/datasets/mnist.rb', line 7

def label
  @label
end

Instance Method Details

#pixels ⇒ Object



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

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

#to_h ⇒ Object



12
13
14
15
16
# File 'lib/datasets/mnist.rb', line 12

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