lib/xlearn/dmatrix.rb in xlearn-0.1.4 vs lib/xlearn/dmatrix.rb in xlearn-0.1.5

- old
+ new

@@ -10,10 +10,13 @@ ncol = data.column_count flat_data = data.to_a.flatten elsif daru?(data) nrow, ncol = data.shape flat_data = data.map_rows(&:to_a).flatten + elsif rover?(data) + nrow, ncol = data.shape + flat_data = data.each_row.map(&:values).flatten elsif narray?(data) nrow, ncol = data.shape # TODO convert to SFloat and pass pointer # for better performance flat_data = data.flatten.to_a @@ -58,8 +61,12 @@ defined?(Daru::DataFrame) && data.is_a?(Daru::DataFrame) end def narray?(data) defined?(Numo::NArray) && data.is_a?(Numo::NArray) + end + + def rover?(data) + defined?(Rover::DataFrame) && data.is_a?(Rover::DataFrame) end end end