lib/rumale/ensemble/gradient_boosting_classifier.rb
# Calculate confidence scores for samples.
#
# @param x [Numo::DFloat] (shape: [n_samples, n_features]) The samples to compute the scores.
# @return [Numo::DFloat] (shape: [n_samples, n_classes]) Confidence score per sample.
Calculate confidence scores for samples.
Calculate confidence scores for samples .
def decision_function(x)
        x = check_convert_sample_array(x)
        n_classes = @classes.size
        if n_classes > 2
          multiclass_scores(x)
        else
          @estimators.map { |tree| tree.predict(x) }.reduce(&:+) + @base_predictions
        end
      end
def decision_function ( x ) x = check_convert_sample_array ( x ) n_classes = @classes . size if n_classes > 2 multiclass_scores ( x ) else @estimators . map { | tree | tree . predict ( x ) } . reduce ( & :+ ) + @base_predictions end end
Calculate confidence scores for samples.
Calculate confidence scores for samples .
[n_samples, n_classes]) Confidence score per sample.
[ n_samples n_classes ] ) Confidence score per sample .
Numo::DFloat
x
[n_samples, n_features]) The samples to compute the scores.
[ n_samples n_features ] ) The samples to compute the scores .