lib/rumale/kernel_machine/kernel_svc.rb
# Predict class labels for samples.
#
# @param x [Numo::DFloat] (shape: [n_testing_samples, n_training_samples])
#     The kernel matrix between testing samples and training samples to predict the labels.
# @return [Numo::Int32] (shape: [n_testing_samples]) Predicted class label per sample.
Predict class labels for samples.
Predict class labels for samples .
def predict(x)
        x = check_convert_sample_array(x)
        return Numo::Int32.cast(decision_function(x).ge(0.0)) * 2 - 1 if @classes.size <= 2
        n_samples, = x.shape
        decision_values = decision_function(x)
        predicted = if enable_parallel?
                      parallel_map(n_samples) { |n| @classes[decision_values[n, true].max_index] }
                    else
                      Array.new(n_samples) { |n| @classes[decision_values[n, true].max_index] }
                    end
        Numo::Int32.asarray(predicted)
      end
def predict ( x ) x = check_convert_sample_array ( x ) return Numo :: Int32 . cast ( decision_function ( x ) . ge ( 0.0 ) ) * 2 - 1 if @classes . size <= 2 n_samples , = x . shape decision_values = decision_function ( x ) predicted = if enable_parallel? parallel_map ( n_samples ) { | n | @classes [ decision_values [ n , true ] . max_index ] } else Array . new ( n_samples ) { | n | @classes [ decision_values [ n , true ] . max_index ] } end Numo :: Int32 . asarray ( predicted ) end
Predict class labels for samples.
Predict class labels for samples .
[n_testing_samples]) Predicted class label per sample.
[ n_testing_samples ] ) Predicted class label per sample .
Numo::Int32
x
[n_testing_samples, n_training_samples]) The kernel matrix between testing samples and training samples to predict the labels.
[ n_testing_samples n_training_samples ] ) The kernel matrix between testing samples and training samples to predict the labels .