lib/rumale/ensemble/gradient_boosting_classifier.rb in rumale-ensemble-0.25.0 vs lib/rumale/ensemble/gradient_boosting_classifier.rb in rumale-ensemble-0.26.0
- old
+ new
@@ -95,11 +95,11 @@
::Rumale::Validation.check_sample_size(x, y)
# initialize some variables.
n_features = x.shape[1]
@params[:max_features] = n_features if @params[:max_features].nil?
- @params[:max_features] = [[1, @params[:max_features]].max, n_features].min
+ @params[:max_features] = [[1, @params[:max_features]].max, n_features].min # rubocop:disable Style/ComparableClamp
@classes = Numo::Int32[*y.to_a.uniq.sort]
n_classes = @classes.size
# train estimator.
if n_classes > 2
@base_predictions = multiclass_base_predictions(y)
@@ -185,10 +185,10 @@
def partial_fit(x, y, init_pred)
# initialize some variables.
estimators = []
n_samples = x.shape[0]
- n_sub_samples = [n_samples, [(n_samples * @params[:subsample]).to_i, 1].max].min
+ n_sub_samples = [n_samples, [(n_samples * @params[:subsample]).to_i, 1].max].min # rubocop:disable Style/ComparableClamp
whole_ids = Array.new(n_samples) { |v| v }
y_pred = Numo::DFloat.ones(n_samples) * init_pred
sub_rng = @rng.dup
# grow trees.
@params[:n_estimators].times do |_t|