New! Use Simple ML for Sheets to apply machine learning to the data in your Google Sheets
Read More
tfdf.py_tree.node.LeafNode
Stay organized with collections
Save and categorize content based on your preferences.
A leaf node i.e. the node containing a prediction/value/output.
Inherits From: AbstractNode
tfdf.py_tree.node.LeafNode(
value: tfdf.py_tree.node.AbstractValue
,
leaf_idx: Optional[int] = None
)
Attributes |
leaf_idx
|
Index of the leaf in the tree in a depth first exploration.
|
value
|
|
Methods
pretty
View source
pretty(
prefix: str, is_pos: Optional[bool], depth: int, max_depth: Optional[int]
) -> str
Returns a recursive readable textual representation of a node.
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.
|
Returns |
A pretty-string representing the node and its children.
|
scan_structure
View source
scan_structure(
conditions: tfdf.py_tree.node.ScanStructureAccumulator
)
Extracts the condition values and default evaluations.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-04-26 UTC.
[null,null,["Last updated 2024-04-26 UTC."],[],[],null,["# tfdf.py_tree.node.LeafNode\n\n\u003cbr /\u003e\n\n|---------------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/decision-forests/blob/main/tensorflow_decision_forests/component/py_tree/node.py#L168-L206) |\n\nA leaf node i.e. the node containing a prediction/value/output.\n\nInherits From: [`AbstractNode`](../../../tfdf/py_tree/node/AbstractNode) \n\n tfdf.py_tree.node.LeafNode(\n value: ../../../tfdf/py_tree/node/AbstractValue,\n leaf_idx: Optional[int] = None\n )\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Attributes ---------- ||\n|------------|-------------------------------------------------------------|\n| `leaf_idx` | Index of the leaf in the tree in a depth first exploration. |\n| `value` | \u003cbr /\u003e \u003cbr /\u003e |\n\n\u003cbr /\u003e\n\nMethods\n-------\n\n### `pretty`\n\n[View source](https://github.com/tensorflow/decision-forests/blob/main/tensorflow_decision_forests/component/py_tree/node.py#L196-L206) \n\n pretty(\n prefix: str, is_pos: Optional[bool], depth: int, max_depth: Optional[int]\n ) -\u003e str\n\nReturns a recursive readable textual representation of a node.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|-------------|----------------------------------------------------------------------------------|\n| `prefix` | Prefix printed on the left side. Used to print the surrounding edges. |\n| `is_pos` | True/False if the node is a positive/negative child. None if the node is a root. |\n| `depth` | Depth of the node in the tree. There is no assuption of on the depth of a root. |\n| `max_depth` | Maximum depth for representation. Deeper nodes are skipped. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|---|---|\n| A pretty-string representing the node and its children. ||\n\n\u003cbr /\u003e\n\n### `scan_structure`\n\n[View source](https://github.com/tensorflow/decision-forests/blob/main/tensorflow_decision_forests/component/py_tree/node.py#L134-L136) \n\n scan_structure(\n conditions: ../../../tfdf/py_tree/node/ScanStructureAccumulator\n )\n\nExtracts the condition values and default evaluations."]]