Class: XGBoost::PackedBooster
- Inherits:
-
Object
- Object
- XGBoost::PackedBooster
- Defined in:
- lib/xgboost/packed_booster.rb
Instance Method Summary collapse
- #attr(key) ⇒ Object
- #best_iteration ⇒ Object
- #best_iteration=(iteration) ⇒ Object
- #best_score ⇒ Object
- #best_score=(score) ⇒ Object
- #eval_set(iteration) ⇒ Object
-
#initialize(cvfolds) ⇒ PackedBooster
constructor
A new instance of PackedBooster.
- #num_boosted_rounds ⇒ Object
- #set_attr(**kwargs) ⇒ Object
- #update(iteration) ⇒ Object
Constructor Details
#initialize(cvfolds) ⇒ PackedBooster
Returns a new instance of PackedBooster.
3 4 5 |
# File 'lib/xgboost/packed_booster.rb', line 3 def initialize(cvfolds) @cvfolds = cvfolds end |
Instance Method Details
#attr(key) ⇒ Object
19 20 21 |
# File 'lib/xgboost/packed_booster.rb', line 19 def attr(key) @cvfolds[0].bst.attr(key) end |
#best_iteration ⇒ Object
27 28 29 |
# File 'lib/xgboost/packed_booster.rb', line 27 def best_iteration @cvfolds[0].bst.best_iteration end |
#best_iteration=(iteration) ⇒ Object
31 32 33 34 35 |
# File 'lib/xgboost/packed_booster.rb', line 31 def best_iteration=(iteration) @cvfolds.each do |fold| fold.best_iteration = iteration end end |
#best_score ⇒ Object
37 38 39 |
# File 'lib/xgboost/packed_booster.rb', line 37 def best_score @cvfolds[0].bst.best_score end |
#best_score=(score) ⇒ Object
41 42 43 44 45 |
# File 'lib/xgboost/packed_booster.rb', line 41 def best_score=(score) @cvfolds.each do |fold| fold.best_score = score end end |
#eval_set(iteration) ⇒ Object
23 24 25 |
# File 'lib/xgboost/packed_booster.rb', line 23 def eval_set(iteration) @cvfolds.map { |f| f.eval_set(iteration) } end |
#num_boosted_rounds ⇒ Object
47 48 49 |
# File 'lib/xgboost/packed_booster.rb', line 47 def num_boosted_rounds @cvfolds[0].num_boosted_rounds end |
#set_attr(**kwargs) ⇒ Object
13 14 15 16 17 |
# File 'lib/xgboost/packed_booster.rb', line 13 def set_attr(**kwargs) @cvfolds.each do |f| f.bst.set_attr(**kwargs) end end |
#update(iteration) ⇒ Object
7 8 9 10 11 |
# File 'lib/xgboost/packed_booster.rb', line 7 def update(iteration) @cvfolds.each do |fold| fold.update(iteration) end end |