Class: LightGBM::Ranker
Instance Attribute Summary
Attributes inherited from Model
Instance Method Summary collapse
- #fit(x, y, group:, categorical_feature: "auto", early_stopping_rounds: nil, verbose: true) ⇒ Object
-
#initialize(num_leaves: 31, learning_rate: 0.1, n_estimators: 100, objective: "lambdarank", **options) ⇒ Ranker
constructor
A new instance of Ranker.
- #predict(data, num_iteration: nil) ⇒ Object
Methods inherited from Model
#best_iteration, #feature_importances, #load_model, #save_model
Constructor Details
#initialize(num_leaves: 31, learning_rate: 0.1, n_estimators: 100, objective: "lambdarank", **options) ⇒ Ranker
Returns a new instance of Ranker.
3 4 5 |
# File 'lib/lightgbm/ranker.rb', line 3 def initialize(num_leaves: 31, learning_rate: 0.1, n_estimators: 100, objective: "lambdarank", **) super end |
Instance Method Details
#fit(x, y, group:, categorical_feature: "auto", early_stopping_rounds: nil, verbose: true) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/lightgbm/ranker.rb', line 7 def fit(x, y, group:, categorical_feature: "auto", early_stopping_rounds: nil, verbose: true) train_set = Dataset.new(x, label: y, group: group, categorical_feature: categorical_feature) @booster = LightGBM.train(@params, train_set, num_boost_round: @n_estimators, early_stopping_rounds: early_stopping_rounds, verbose_eval: verbose ) nil end |
#predict(data, num_iteration: nil) ⇒ Object
17 18 19 |
# File 'lib/lightgbm/ranker.rb', line 17 def predict(data, num_iteration: nil) @booster.predict(data, num_iteration: num_iteration) end |