lib/lightgbm.rb in lightgbm-0.1.2 vs lib/lightgbm.rb in lightgbm-0.1.3
- old
+ new
@@ -6,15 +6,19 @@
require "lightgbm/booster"
require "lightgbm/dataset"
require "lightgbm/ffi"
require "lightgbm/version"
+# scikit-learn API
+require "lightgbm/classifier"
+require "lightgbm/regressor"
+
module LightGBM
class Error < StandardError; end
class << self
- def train(params, train_set,num_boost_round: 100, valid_sets: [], valid_names: [], early_stopping_rounds: nil, verbose_eval: true)
+ def train(params, train_set, num_boost_round: 100, valid_sets: [], valid_names: [], early_stopping_rounds: nil, verbose_eval: true)
booster = Booster.new(params: params, train_set: train_set)
valid_contain_train = false
valid_sets.zip(valid_names).each_with_index do |(data, name), i|
if data == train_set
@@ -148,9 +152,10 @@
puts message_parts.join("\t") if verbose_eval
if early_stopping_rounds
stop_early = false
means.each do |k, score|
+ # TODO fix higher better
if best_score[k].nil? || score < best_score[k]
best_score[k] = score
best_iter[k] = iteration
elsif iteration - best_iter[k] >= early_stopping_rounds
stop_early = true