# tf.raw_ops.BoostedTreesCalculateBestFeatureSplitV2

<br />

Calculates gains for each feature and returns the best possible split information for each node. However, if no split is found, then no split information is returned for that node.

#### View aliases


**Compat aliases for migration**

See
[Migration guide](https://www.tensorflow.org/guide/migrate) for
more details.

[`tf.compat.v1.raw_ops.BoostedTreesCalculateBestFeatureSplitV2`](https://www.tensorflow.org/api_docs/python/tf/raw_ops/BoostedTreesCalculateBestFeatureSplitV2)

<br />

    tf.raw_ops.BoostedTreesCalculateBestFeatureSplitV2(
        node_id_range,
        stats_summaries_list,
        split_types,
        candidate_feature_ids,
        l1,
        l2,
        tree_complexity,
        min_node_weight,
        logits_dimension,
        name=None
    )

The split information is the best threshold (bucket id), gains and left/right node contributions per node for each feature.

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.

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).

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.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `node_id_range` | A `Tensor` of type `int32`. 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). |
| `stats_summaries_list` | A list of at least 1 `Tensor` objects with type `float32`. A list of 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. 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. |
| `split_types` | A `Tensor` of type `string`. A Rank 1 tensor indicating if this Op should perform inequality split or equality split per feature. |
| `candidate_feature_ids` | A `Tensor` of type `int32`. Rank 1 tensor with ids for each feature. This is the real id of the feature. |
| `l1` | A `Tensor` of type `float32`. l1 regularization factor on leaf weights, per instance based. |
| `l2` | A `Tensor` of type `float32`. l2 regularization factor on leaf weights, per instance based. |
| `tree_complexity` | A `Tensor` of type `float32`. adjustment to the gain, per leaf based. |
| `min_node_weight` | A `Tensor` of type `float32`. minimum avg of hessians in a node before required for the node to be considered for splitting. |
| `logits_dimension` | An `int` that is `>= 1`. The dimension of logit, i.e., number of classes. |
| `name` | A name for the operation (optional). |

<br />

<br />

| ## Returns ||
|---|---|
| A tuple of `Tensor` objects (node_ids, gains, feature_ids, feature_dimensions, thresholds, left_node_contribs, right_node_contribs, split_with_default_directions). ||
| `node_ids` | A `Tensor` of type `int32`. |
| `gains` | A `Tensor` of type `float32`. |
| `feature_ids` | A `Tensor` of type `int32`. |
| `feature_dimensions` | A `Tensor` of type `int32`. |
| `thresholds` | A `Tensor` of type `int32`. |
| `left_node_contribs` | A `Tensor` of type `float32`. |
| `right_node_contribs` | A `Tensor` of type `float32`. |
| `split_with_default_directions` | A `Tensor` of type `string`. |

<br />