Sha256: d9f977bffa5a49587f19ae5f6f2de01fb1c8d70dfcd6b585a38c404f6f69257e

Contents?: true

Size: 900 Bytes

Versions: 2

Compression:

Stored size: 900 Bytes

Contents

module XGBoost
  class PackedBooster
    def initialize(cvfolds)
      @cvfolds = cvfolds
    end

    def update(iteration)
      @cvfolds.each do |fold|
        fold.update(iteration)
      end
    end

    def set_attr(**kwargs)
      @cvfolds.each do |f|
        f.bst.set_attr(**kwargs)
      end
    end

    def attr(key)
      @cvfolds[0].bst.attr(key)
    end

    def eval_set(iteration)
      @cvfolds.map { |f| f.eval_set(iteration) }
    end

    def best_iteration
      @cvfolds[0].bst.best_iteration
    end

    def best_iteration=(iteration)
      @cvfolds.each do |fold|
        fold.best_iteration = iteration
      end
    end

    def best_score
      @cvfolds[0].bst.best_score
    end

    def best_score=(score)
      @cvfolds.each do |fold|
        fold.best_score = score
      end
    end

    def num_boosted_rounds
      @cvfolds[0].num_boosted_rounds
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

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