lib/lightgbm.rb in lightgbm-0.1.4 vs lib/lightgbm.rb in lightgbm-0.1.5
- old
+ new
@@ -18,11 +18,12 @@
class << self
attr_accessor :ffi_lib
end
lib_name = "lib_lightgbm.#{::FFI::Platform::LIBSUFFIX}"
- self.ffi_lib = [lib_name, "lib_lightgbm.so"]
+ vendor_lib = File.expand_path("../vendor/#{lib_name}", __dir__)
+ self.ffi_lib = [lib_name, "lib_lightgbm.so", vendor_lib]
# friendlier error message
autoload :FFI, "lightgbm/ffi"
class << self
@@ -36,9 +37,11 @@
valid_contain_train = true
else
booster.add_valid(data, name || "valid_#{i}")
end
end
+
+ raise ArgumentError, "For early stopping, at least one validation set is required" if early_stopping_rounds && !valid_sets.any? { |v| v != train_set }
booster.best_iteration = 0
if early_stopping_rounds
best_score = []