You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// containing accumulated stats for each node, feature dimension and bucket.
2680
+
@inlinable @inline(__always)
2681
+
public static func boostedTreesAggregateStats(
2682
+
nodeIds: Tensor<Int32>,
2683
+
gradients: Tensor<Float>,
2684
+
hessians: Tensor<Float>,
2685
+
feature: Tensor<Int32>,
2686
+
maxSplits: Int64,
2687
+
numBuckets: Int64
2688
+
) -> Tensor<Float> {
2689
+
let ret: TensorHandle<Float> = #tfop("BoostedTreesAggregateStats",
2690
+
nodeIds,
2691
+
gradients,
2692
+
hessians,
2693
+
feature,
2694
+
max_splits: maxSplits,
2695
+
num_buckets: numBuckets)
2696
+
return Tensor(handle: ret)
2697
+
}
2698
+
2699
+
/// Calculates gains for each feature and returns the best possible split information for the feature.
2700
+
///
2701
+
/// The split information is the best threshold (bucket id), gains and left/right node contributions per node for each feature.
2702
+
///
2703
+
/// It is possible that not all nodes can be split on each feature. Hence, the list of possible nodes can differ between the features. Therefore, we return `node_ids_list` for each feature, containing the list of nodes that this feature can be used to split.
2704
+
///
2705
+
/// In this manner, the output is the best split per features and per node, so that it needs to be combined later to produce the best split for each node (among all possible features).
2706
+
///
2707
+
/// The output shapes are compatible in a way that the first dimension of all tensors are the same and equal to the number of possible split nodes for each feature.
2708
+
///
2709
+
/// - Parameters:
2710
+
/// - node_id_range: A Rank 1 tensor (shape=[2]) to specify the range [first, last) of node ids to process within `stats_summary_list`. The nodes are iterated between the two nodes specified by the tensor, as like `for node_id in range(node_id_range[0], node_id_range[1])` (Note that the last index node_id_range[1] is exclusive).
2711
+
/// - stats_summary: A Rank 4 tensor (#shape=[max_splits, feature_dims, bucket, stats_dims]) for accumulated stats summary (gradient/hessian) per node, per dimension, per buckets for each feature.
2712
+
/// The first dimension of the tensor is the maximum number of splits, and thus not all elements of it will be used, but only the indexes specified by node_ids will be used.
2713
+
/// - l1: l1 regularization factor on leaf weights, per instance based.
2714
+
/// - l2: l2 regularization factor on leaf weights, per instance based.
2715
+
/// - tree_complexity: adjustment to the gain, per leaf based.
2716
+
/// - min_node_weight: mininum avg of hessians in a node before required for the node to be considered for splitting.
2717
+
///
2718
+
/// - Attrs:
2719
+
/// - logits_dimension: The dimension of logit, i.e., number of classes.
2720
+
/// - split_type: A string indicating if this Op should perform inequality split or equality split.
2721
+
///
2722
+
/// - Outputs:
2723
+
/// - node_ids: A Rank 1 tensors indicating possible split node ids for each feature. The length of the list is num_features, but each tensor has different size as each feature provides different possible nodes. See above for details like shapes and sizes.
2724
+
/// - gains: A Rank 1 tensors indicating the best gains for each feature to split for certain nodes. See above for details like shapes and sizes.
2725
+
/// - feature_dimensions: A Rank 1 tensors indicating the best feature dimension for each feature to split for certain nodes if the feature is multi-dimension. See above for details like shapes and sizes.
2726
+
/// - thresholds: A Rank 1 tensors indicating the bucket id to compare with (as a threshold) for split in each node. See above for details like shapes and sizes.
2727
+
/// - left_node_contribs: A Rank 2 tensors indicating the contribution of the left nodes when branching from parent nodes (given by the tensor element in the output node_ids_list) to the left direction by the given threshold for each feature. This value will be used to make the left node value by adding to the parent node value. Second dimension size is 1 for 1-dimensional logits, but would be larger for multi-class problems. See above for details like shapes and sizes.
2728
+
/// - right_node_contribs: A Rank 2 tensors, with the same shape/conditions as left_node_contribs_list, but just that the value is for the right node.
2729
+
/// - split_with_default_directions: A Rank 1 tensors indicating the which direction to go if data is missing. See above for details like shapes and sizes.
2730
+
@inlinable @inline(__always)
2731
+
public static func boostedTreesCalculateBestFeatureSplit(
0 commit comments