Class: Pairwise::InputData

Inherits:
Object
  • Object
show all
Defined in:
lib/pairwise/input_data.rb

Instance Method Summary collapse

Constructor Details

#initialize(inputs) ⇒ InputData

Returns a new instance of InputData.



4
5
6
# File 'lib/pairwise/input_data.rb', line 4

def initialize(inputs)
  @inputs = inputs.is_a?(Hash) ? hash_inputs_to_list(inputs) : inputs
end

Instance Method Details

#dataObject



8
9
10
# File 'lib/pairwise/input_data.rb', line 8

def data
  @data ||= @inputs.map {|input| input.values[0]}
end

#labelsObject



12
13
14
# File 'lib/pairwise/input_data.rb', line 12

def labels
  @labels ||= @inputs.map{|input| input.keys}.flatten
end