Sha256: 241624a0a2b9f6d22e2f666b1c945f6e780772e7ec9f621e023f12148e49c555
Contents?: true
Size: 648 Bytes
Versions: 2
Compression:
Stored size: 648 Bytes
Contents
module Xgb class Regressor < Model def initialize(max_depth: 3, learning_rate: 0.1, n_estimators: 100, objective: "reg:squarederror", importance_type: "gain", **options) super end def fit(x, y, eval_set: nil, early_stopping_rounds: nil, verbose: true) dtrain = DMatrix.new(x, label: y) evals = Array(eval_set).map.with_index { |v, i| [DMatrix.new(v[0], label: v[1]), "validation_#{i}"] } @booster = Xgb.train(@params, dtrain, num_boost_round: @n_estimators, early_stopping_rounds: early_stopping_rounds, verbose_eval: verbose, evals: evals ) nil end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
xgb-0.1.3 | lib/xgb/regressor.rb |
xgb-0.1.2 | lib/xgb/regressor.rb |