lib/rumale/ensemble/extra_trees_regressor.rb in rumale-0.14.2 vs lib/rumale/ensemble/extra_trees_regressor.rb in rumale-0.14.3

- old
+ new

@@ -40,11 +40,11 @@ # If nil is given, extra tree grows without concern for depth. # @param max_leaf_nodes [Integer] The maximum number of leaves on extra tree. # If nil is given, number of leaves is not limited. # @param min_samples_leaf [Integer] The minimum number of samples at a leaf node. # @param max_features [Integer] The number of features to consider when searching optimal split point. - # If nil is given, split process considers all features. + # If nil is given, split process considers 'Math.sqrt(n_features)' features. # @param n_jobs [Integer] The number of jobs for running the fit and predict methods in parallel. # If nil is given, the methods do not execute in parallel. # If zero or less is given, it becomes equal to the number of processors. # This parameter is ignored if the Parallel gem is not loaded. # @param random_seed [Integer] The seed value using to initialize the random generator. @@ -71,10 +71,10 @@ x = check_convert_sample_array(x) y = check_convert_tvalue_array(y) check_sample_tvalue_size(x, y) # Initialize some variables. n_features = x.shape[1] - @params[:max_features] = Math.sqrt(n_features).to_i unless @params[:max_features].is_a?(Integer) + @params[:max_features] = Math.sqrt(n_features).to_i if @params[:max_features].nil? @params[:max_features] = [[1, @params[:max_features]].max, n_features].min sub_rng = @rng.dup # Construct forest. rng_seeds = Array.new(@params[:n_estimators]) { sub_rng.rand(Rumale::Values.int_max) } @estimators = if enable_parallel?