# tfdf.py_tree.node.NonLeafNode

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/decision-forests/blob/main/tensorflow_decision_forests/component/py_tree/node.py#L209-L344) |

A non-leaf node i.e.

Inherits From: [`AbstractNode`](https://www.tensorflow.org/decision_forests/api_docs/python/tfdf/py_tree/node/AbstractNode)

    tfdf.py_tree.node.NonLeafNode(
        condition: https://www.tensorflow.org/decision_forests/api_docs/python/tfdf/py_tree/condition/AbstractCondition,
        pos_child: Optional[https://www.tensorflow.org/decision_forests/api_docs/python/tfdf/py_tree/node/AbstractNode] = None,
        neg_child: Optional[https://www.tensorflow.org/decision_forests/api_docs/python/tfdf/py_tree/node/AbstractNode] = None,
        value: Optional[https://www.tensorflow.org/decision_forests/api_docs/python/tfdf/py_tree/node/AbstractValue] = None
    )

a node containing a split/condition.

<br />

<br />

<br />

| ## Attributes ||
|---|---|
| `condition` | The binary condition of the node. |
| `pos_child` | The child to visit when the condition is true. |
| `neg_child` | The child to visit when the condition is false. |
| `value` | The value/prediction/output of the node if it was a leaf. Not used during prediction. |

<br />

## Methods

### `pretty`

[View source](https://github.com/tensorflow/decision-forests/blob/main/tensorflow_decision_forests/component/py_tree/node.py#L312-L344)

    pretty(
        prefix: str, is_pos: Optional[bool], depth: int, max_depth: Optional[int]
    ) -> str

Returns a recursive readable textual representation of a node.

<br />

<br />

<br />

| Args ||
|---|---|
| `prefix` | Prefix printed on the left side. Used to print the surrounding edges. |
| `is_pos` | True/False if the node is a positive/negative child. None if the node is a root. |
| `depth` | Depth of the node in the tree. There is no assuption of on the depth of a root. |
| `max_depth` | Maximum depth for representation. Deeper nodes are skipped. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| A pretty-string representing the node and its children. ||

<br />

### `scan_structure`

[View source](https://github.com/tensorflow/decision-forests/blob/main/tensorflow_decision_forests/component/py_tree/node.py#L266-L288)

    scan_structure(
        conditions: https://www.tensorflow.org/decision_forests/api_docs/python/tfdf/py_tree/node/ScanStructureAccumulator
    )

Scans the structure of the tree.