Sha256: 5c22d16d4acfbfb528edb5954a839adb197e43c07ec0a273440c3d38d984b126
Contents?: true
Size: 622 Bytes
Versions: 14
Compression:
Stored size: 622 Bytes
Contents
module XGBoost class Regressor < Model def initialize(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
14 entries across 14 versions & 2 rubygems