lib/rumale/ensemble/voting_classifier.rb
# Fit the model with given training data.
#
# @param x [Numo::DFloat] (shape: [n_samples, n_features]) The training data to be used for fitting the model.
# @param y [Numo::Int32] (shape: [n_samples]) The labels to be used for fitting the model.
# @return [VotingClassifier] The learned classifier itself.
Fit the model with given training data.
Fit the model with given training data .
def fit(x, y)
        x = check_convert_sample_array(x)
        y = check_convert_label_array(y)
        check_sample_label_size(x, y)
        @encoder = Rumale::Preprocessing::LabelEncoder.new
        y_encoded = @encoder.fit_transform(y)
        @classes = Numo::NArray[*@encoder.classes]
        @estimators.each_key { |name| @estimators[name].fit(x, y_encoded) }
        self
      end
def fit ( x , y ) x = check_convert_sample_array ( x ) y = check_convert_label_array ( y ) check_sample_label_size ( x , y ) @encoder = Rumale :: Preprocessing :: LabelEncoder . new y_encoded = @encoder . fit_transform ( y ) @classes = Numo :: NArray [ * @encoder . classes ] @estimators . each_key { | name | @estimators [ name ] . fit ( x , y_encoded ) } self end
Fit the model with given training data.
Fit the model with given training data .
The learned classifier itself.
The learned classifier itself .
VotingClassifier
x
[n_samples, n_features]) The training data to be used for fitting the model.
[ n_samples n_features ] ) The training data to be used for fitting the model .
y
[n_samples]) The labels to be used for fitting the model.
[ n_samples ] ) The labels to be used for fitting the model .