lib/rumale/tree/gradient_tree_regressor.rb in rumale-0.18.2 vs lib/rumale/tree/gradient_tree_regressor.rb in rumale-0.18.3
- old
+ new
@@ -116,30 +116,9 @@
def apply(x)
x = check_convert_sample_array(x)
Numo::Int32[*(Array.new(x.shape[0]) { |n| apply_at_node(@tree, x[n, true]) })]
end
- # Dump marshal data.
- # @return [Hash] The marshal data about DecisionTreeRegressor
- def marshal_dump
- { params: @params,
- tree: @tree,
- feature_importances: @feature_importances,
- leaf_weights: @leaf_weights,
- rng: @rng }
- end
-
- # Load marshal data.
- # @return [nil]
- def marshal_load(obj)
- @params = obj[:params]
- @tree = obj[:tree]
- @feature_importances = obj[:feature_importances]
- @leaf_weights = obj[:leaf_weights]
- @rng = obj[:rng]
- nil
- end
-
private
def apply_at_node(node, sample)
return node.leaf_id if node.leaf
return apply_at_node(node.left, sample) if node.right.nil?