lib/rumale/tree/decision_tree_regressor.rb
# Fit the model with given training data.
#
# @param x [Numo::DFloat] (shape: [n_samples, n_features]) The training data to be used for fitting the model.
# @param y [Numo::DFloat] (shape: [n_samples, n_outputs]) The taget values to be used for fitting the model.
# @return [DecisionTreeRegressor] The learned regressor itself.
Fit the model with given training data.
Fit the model with given training data .
def fit(x, y)
        x = check_convert_sample_array(x)
        y = check_convert_tvalue_array(y)
        check_sample_tvalue_size(x, y)
        n_samples, n_features = x.shape
        @params[:max_features] = n_features if @params[:max_features].nil?
        @params[:max_features] = [@params[:max_features], n_features].min
        @n_leaves = 0
        @leaf_values = []
        @sub_rng = @rng.dup
        build_tree(x, y)
        eval_importance(n_samples, n_features)
        @leaf_values = Numo::DFloat.cast(@leaf_values)
        @leaf_values = @leaf_values.flatten.dup if @leaf_values.shape[1] == 1
        self
      end
def fit ( x , y ) x = check_convert_sample_array ( x ) y = check_convert_tvalue_array ( y ) check_sample_tvalue_size ( x , y ) n_samples , n_features = x . shape @params [ :max_features ] = n_features if @params [ :max_features ] . nil? @params [ :max_features ] = [ @params [ :max_features ] , n_features ] . min @n_leaves = 0 @leaf_values = [ ] @sub_rng = @rng . dup build_tree ( x , y ) eval_importance ( n_samples , n_features ) @leaf_values = Numo :: DFloat . cast ( @leaf_values ) @leaf_values = @leaf_values . flatten . dup if @leaf_values . shape [ 1 ] == 1 self end
Fit the model with given training data.
Fit the model with given training data .
The learned regressor itself.
The learned regressor itself .
DecisionTreeRegressor
x
[n_samples, n_features]) The training data to be used for fitting the model.
[ n_samples n_features ] ) The training data to be used for fitting the model .
y
[n_samples, n_outputs]) The taget values to be used for fitting the model.
[ n_samples n_outputs ] ) The taget values to be used for fitting the model .