class LightGBM::Ranker
Public Class Methods
new(num_leaves: 31, learning_rate: 0.1, n_estimators: 100, objective: "lambdarank", **options)
click to toggle source
Calls superclass method
LightGBM::Model::new
# File lib/lightgbm/ranker.rb, line 3 def initialize(num_leaves: 31, learning_rate: 0.1, n_estimators: 100, objective: "lambdarank", **options) super end
Public Instance Methods
fit(x, y, group:, categorical_feature: "auto", early_stopping_rounds: nil, verbose: true)
click to toggle source
# 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)
click to toggle source
# File lib/lightgbm/ranker.rb, line 17 def predict(data, num_iteration: nil) @booster.predict(data, num_iteration: num_iteration) end