Method: LightGBM::Classifier#predict_proba

Defined in:
lib/lightgbm/classifier.rb

#predict_proba(data, num_iteration: nil) ⇒ Object



44
45
46
47
48
49
50
51
52
53
# File 'lib/lightgbm/classifier.rb', line 44

def predict_proba(data, num_iteration: nil)
  y_pred = @booster.predict(data, num_iteration: num_iteration)

  if y_pred.first.is_a?(Array)
    # multiple classes
    y_pred
  else
    y_pred.map { |v| [1 - v, v] }
  end
end