lib/rumale/tree/gradient_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]) The taget values to be used for fitting the model.
# @param g [Numo::DFloat] (shape: [n_samples]) The gradient of loss function.
# @param h [Numo::DFloat] (shape: [n_samples]) The hessian of loss function.
# @return [GradientTreeRegressor] The learned regressor itself.
Fit the model with given training data.
Fit the model with given training data .
def fit(x, y, g, h)
        x = check_convert_sample_array(x)
        y = check_convert_tvalue_array(y)
        g = check_convert_tvalue_array(g)
        h = check_convert_tvalue_array(h)
        check_sample_tvalue_size(x, y)
        n_features = x.shape[1]
        @params[:max_features] ||= n_features
        @n_leaves = 0
        @leaf_weights = []
        @feature_importances = Numo::DFloat.zeros(n_features)
        @sub_rng = @rng.dup
        build_tree(x, y, g, h)
        @leaf_weights = Numo::DFloat[*@leaf_weights]
        self
      end
def fit ( x , y , g , h ) x = check_convert_sample_array ( x ) y = check_convert_tvalue_array ( y ) g = check_convert_tvalue_array ( g ) h = check_convert_tvalue_array ( h ) check_sample_tvalue_size ( x , y ) n_features = x . shape [ 1 ] @params [ :max_features ] ||= n_features @n_leaves = 0 @leaf_weights = [ ] @feature_importances = Numo :: DFloat . zeros ( n_features ) @sub_rng = @rng . dup build_tree ( x , y , g , h ) @leaf_weights = Numo :: DFloat [ * @leaf_weights ] self end
Fit the model with given training data.
Fit the model with given training data .
# Initialize some variables. # Build tree.
The learned regressor itself.
The learned regressor itself .
GradientTreeRegressor
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]) The taget values to be used for fitting the model.
[ n_samples ] ) The taget values to be used for fitting the model .
g
[n_samples]) The gradient of loss function.
[ n_samples ] ) The gradient of loss function .
h
[n_samples]) The hessian of loss function.
[ n_samples ] ) The hessian of loss function .