Class: RubyZero::Data::Presets::Xor
- Defined in:
- lib/rubyzero/data/presets/xor.rb
Instance Method Summary collapse
- #getitem(idx) ⇒ Object
-
#initialize ⇒ Xor
constructor
A new instance of Xor.
- #length ⇒ Object
Methods inherited from Dataset
Constructor Details
#initialize ⇒ Xor
Returns a new instance of Xor.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/rubyzero/data/presets/xor.rb', line 3 def initialize @inputs = [ [0, 0], [0, 1], [1, 0], [1, 1] ] @targets = [ [0], [1], [1], [0] ] end |
Instance Method Details
#getitem(idx) ⇒ Object
17 18 19 |
# File 'lib/rubyzero/data/presets/xor.rb', line 17 def getitem(idx) return @inputs[idx], @targets[idx] end |
#length ⇒ Object
20 21 22 |
# File 'lib/rubyzero/data/presets/xor.rb', line 20 def length return 4 end |