Sha256: 048636d7394cb456976cd1c5bf99dfd3c205516a59b660029119504ada69f68b

Contents?: true

Size: 554 Bytes

Versions: 2

Compression:

Stored size: 554 Bytes

Contents

require "forwardable"

module XGBoost
  class CVPack
    extend Forwardable

    def_delegators :@bst, :num_boosted_rounds, :best_iteration=, :best_score=

    attr_reader :bst

    def initialize(dtrain, dtest, param)
      @dtrain = dtrain
      @dtest = dtest
      @watchlist = [[dtrain, "train"], [dtest, "test"]]
      @bst = Booster.new(params: param, cache: [dtrain, dtest])
    end

    def update(iteration)
      @bst.update(@dtrain, iteration)
    end

    def eval_set(iteration)
      @bst.eval_set(@watchlist, iteration)
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
honzasterba_xgb-0.9.0 lib/xgboost/cv_pack.rb
xgb-0.9.0 lib/xgboost/cv_pack.rb