lib/xgboost/dmatrix.rb in xgb-0.7.1 vs lib/xgboost/dmatrix.rb in xgb-0.7.2
- old
+ new
@@ -34,9 +34,13 @@
@feature_names = data.keys
data = data.to_numo
else
nrow = data.count
ncol = data.first.count
+ if !data.all? { |r| r.size == ncol }
+ # TODO raise ArgumentError in 0.8.0
+ raise IndexError, "Rows have different sizes"
+ end
flat_data = data.flatten
end
c_data = ::FFI::MemoryPointer.new(:float, nrow * ncol)
if numo?(data)