Skip to content

Commit

Permalink
chore: change default behavior to not create random subset of features
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshoku committed Dec 15, 2024
1 parent 37e29d3 commit 0b542d5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions rumale-ensemble/lib/rumale/ensemble/vr_trees_classifier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class VRTreesClassifier < RandomForestClassifier
# 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 'Math.sqrt(n_features)' features.
# If nil is given, split process considers 'n_features' features.
# @param n_jobs [Integer] The number of jobs for running the fit method in parallel.
# If nil is given, the method does not execute in parallel.
# If zero or less is given, it becomes equal to the number of processors.
Expand All @@ -72,7 +72,7 @@ def fit(x, y)

# Initialize some variables.
n_features = x.shape[1]
@params[:max_features] = Math.sqrt(n_features).to_i if @params[:max_features].nil?
@params[:max_features] = n_features if @params[:max_features].nil?
@params[:max_features] = @params[:max_features].clamp(1, n_features)
@classes = Numo::Int32.asarray(y.to_a.uniq.sort)
sub_rng = @rng.dup
Expand Down
4 changes: 2 additions & 2 deletions rumale-ensemble/lib/rumale/ensemble/vr_trees_regressor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class VRTreesRegressor < RandomForestRegressor
# 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 'Math.sqrt(n_features)' features.
# If nil is given, split process considers '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.
Expand All @@ -68,7 +68,7 @@ def fit(x, y)

# Initialize some variables.
n_features = x.shape[1]
@params[:max_features] = Math.sqrt(n_features).to_i if @params[:max_features].nil?
@params[:max_features] = n_features if @params[:max_features].nil?
@params[:max_features] = @params[:max_features].clamp(1, n_features)
sub_rng = @rng.dup
# Construct forest.
Expand Down

0 comments on commit 0b542d5

Please sign in to comment.