From 0b542d5272c5321a212176b3e9f64aa1bbe9f498 Mon Sep 17 00:00:00 2001 From: yoshoku Date: Sun, 15 Dec 2024 17:50:23 +0900 Subject: [PATCH] chore: change default behavior to not create random subset of features --- rumale-ensemble/lib/rumale/ensemble/vr_trees_classifier.rb | 4 ++-- rumale-ensemble/lib/rumale/ensemble/vr_trees_regressor.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rumale-ensemble/lib/rumale/ensemble/vr_trees_classifier.rb b/rumale-ensemble/lib/rumale/ensemble/vr_trees_classifier.rb index c1c3ce55..e771db7a 100644 --- a/rumale-ensemble/lib/rumale/ensemble/vr_trees_classifier.rb +++ b/rumale-ensemble/lib/rumale/ensemble/vr_trees_classifier.rb @@ -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. @@ -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 diff --git a/rumale-ensemble/lib/rumale/ensemble/vr_trees_regressor.rb b/rumale-ensemble/lib/rumale/ensemble/vr_trees_regressor.rb index f9e083f1..c7afb498 100644 --- a/rumale-ensemble/lib/rumale/ensemble/vr_trees_regressor.rb +++ b/rumale-ensemble/lib/rumale/ensemble/vr_trees_regressor.rb @@ -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. @@ -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.