lib/rumale/ensemble/gradient_boosting_regressor.rb in rumale-ensemble-0.25.0 vs lib/rumale/ensemble/gradient_boosting_regressor.rb in rumale-ensemble-0.26.0
- old
+ new
@@ -86,11 +86,11 @@
# @return [GradientBoostingRegressor] The learned regressor itself.
def fit(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
n_outputs = y.shape[1].nil? ? 1 : y.shape[1]
# train regressor.
@base_predictions = n_outputs > 1 ? y.mean(0) : y.mean
@estimators = if n_outputs > 1
multivar_estimators(x, y)
@@ -139,10 +139,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|