Sha256: 6e798d37f3ebbcf4031d88e86eeae2d243c585cfced962150b2b0075473a9bf6
Contents?: true
Size: 656 Bytes
Versions: 4
Compression:
Stored size: 656 Bytes
Contents
module XGBoost 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 = XGBoost.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
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
xgb-0.3.1 | lib/xgboost/regressor.rb |
xgb-0.3.0 | lib/xgboost/regressor.rb |
xgb-0.2.1 | lib/xgboost/regressor.rb |
xgb-0.2.0 | lib/xgboost/regressor.rb |