(l-onnx-docai-onnx-ml-TreeEnsembleClassifier)=
# ai.onnx.ml - TreeEnsembleClassifier
(l-onnx-opai-onnx-ml-treeensembleclassifier-5)=
## TreeEnsembleClassifier - 5 (ai.onnx.ml)
### Version
- **name**: [TreeEnsembleClassifier (GitHub)](https://github.com/onnx/onnx/blob/main/docs/Operators-ml.md#ai.onnx.ml.TreeEnsembleClassifier)
- **domain**: `ai.onnx.ml`
- **since_version**: `5`
- **function**: `False`
- **support_level**: `SupportType.COMMON`
- **shape inference**: `False`
This version of the operator has been deprecated
**since version 5 of domain ai.onnx.ml**.
### Summary
This operator is DEPRECATED. Please use TreeEnsemble with provides similar functionality.
In order to determine the top class, the ArgMax node can be applied to the output of TreeEnsemble.
To encode class labels, use a LabelEncoder operator.
Tree Ensemble classifier. Returns the top class for each of N inputs.
The attributes named 'nodes_X' form a sequence of tuples, associated by
index into the sequences, which must all be of equal length. These tuples
define the nodes.
Similarly, all fields prefixed with 'class_' are tuples of votes at the leaves.
A leaf may have multiple votes, where each vote is weighted by
the associated class_weights index.
One and only one of classlabels_strings or classlabels_int64s
will be defined. The class_ids are indices into this list.
All fields ending with _as_tensor can be used instead of the
same parameter without the suffix if the element type is double and not float.
### Attributes
* **base_values - FLOATS** :
Base values for classification, added to final class score; the size must be the same as the classes or can be left unassigned (assumed 0)
* **base_values_as_tensor - TENSOR** :
Base values for classification, added to final class score; the size must be the same as the classes or can be left unassigned (assumed 0)
* **class_ids - INTS** :
The index of the class list that each weight is for.
* **class_nodeids - INTS** :
node id that this weight is for.
* **class_treeids - INTS** :
The id of the tree that this node is in.
* **class_weights - FLOATS** :
The weight for the class in class_id.
* **class_weights_as_tensor - TENSOR** :
The weight for the class in class_id.
* **classlabels_int64s - INTS** :
Class labels if using integer labels.
One and only one of the 'classlabels_*' attributes must be defined.
* **classlabels_strings - STRINGS** :
Class labels if using string labels.
One and only one of the 'classlabels_*' attributes must be defined.
* **nodes_falsenodeids - INTS** :
Child node if expression is false.
* **nodes_featureids - INTS** :
Feature id for each node.
* **nodes_hitrates - FLOATS** :
Popularity of each node, used for performance and may be omitted.
* **nodes_hitrates_as_tensor - TENSOR** :
Popularity of each node, used for performance and may be omitted.
* **nodes_missing_value_tracks_true - INTS** :
For each node, define what to do in the presence of a missing value: if a value is missing (NaN), use the 'true' or 'false' branch based on the value in this array.
This attribute may be left undefined, and the default value is false (0) for all nodes.
* **nodes_modes - STRINGS** :
The node kind, that is, the comparison to make at the node. There is no comparison to make at a leaf node.
One of 'BRANCH_LEQ', 'BRANCH_LT', 'BRANCH_GTE', 'BRANCH_GT', 'BRANCH_EQ', 'BRANCH_NEQ', 'LEAF'
* **nodes_nodeids - INTS** :
Node id for each node. Ids may restart at zero for each tree, but it not required to.
* **nodes_treeids - INTS** :
Tree id for each node.
* **nodes_truenodeids - INTS** :
Child node if expression is true.
* **nodes_values - FLOATS** :
Thresholds to do the splitting on for each node.
* **nodes_values_as_tensor - TENSOR** :
Thresholds to do the splitting on for each node.
* **post_transform - STRING** (default is `'NONE'`):
Indicates the transform to apply to the score.
One of 'NONE,' 'SOFTMAX,' 'LOGISTIC,' 'SOFTMAX_ZERO,' or 'PROBIT.'
### Inputs
- **X** (heterogeneous) - **T1**:
Input of shape [N,F]
### Outputs
- **Y** (heterogeneous) - **T2**:
N, Top class for each point
- **Z** (heterogeneous) - **tensor(float)**:
The class score for each class, for each point, a tensor of shape [N,E].
### Type Constraints
* **T1** in ( `tensor(double)`, `tensor(float)`, `tensor(int32)`, `tensor(int64)` ):
The input type must be a tensor of a numeric type.
* **T2** in ( `tensor(int64)`, `tensor(string)` ):
The output type will be a tensor of strings or integers, depending on which of the classlabels_* attributes is used.
```{toctree}
text_diff_TreeEnsembleClassifier_3_5
```
(l-onnx-opai-onnx-ml-treeensembleclassifier-3)=
## TreeEnsembleClassifier - 3 (ai.onnx.ml)
### Version
- **name**: [TreeEnsembleClassifier (GitHub)](https://github.com/onnx/onnx/blob/main/docs/Operators-ml.md#ai.onnx.ml.TreeEnsembleClassifier)
- **domain**: `ai.onnx.ml`
- **since_version**: `3`
- **function**: `False`
- **support_level**: `SupportType.COMMON`
- **shape inference**: `True`
This version of the operator has been available
**since version 3 of domain ai.onnx.ml**.
### Summary
Tree Ensemble classifier. Returns the top class for each of N inputs.
The attributes named 'nodes_X' form a sequence of tuples, associated by
index into the sequences, which must all be of equal length. These tuples
define the nodes.
Similarly, all fields prefixed with 'class_' are tuples of votes at the leaves.
A leaf may have multiple votes, where each vote is weighted by
the associated class_weights index.
One and only one of classlabels_strings or classlabels_int64s
will be defined. The class_ids are indices into this list.
All fields ending with _as_tensor can be used instead of the
same parameter without the suffix if the element type is double and not float.
### Attributes
* **base_values - FLOATS** :
Base values for classification, added to final class score; the size must be the same as the classes or can be left unassigned (assumed 0)
* **base_values_as_tensor - TENSOR** :
Base values for classification, added to final class score; the size must be the same as the classes or can be left unassigned (assumed 0)
* **class_ids - INTS** :
The index of the class list that each weight is for.
* **class_nodeids - INTS** :
node id that this weight is for.
* **class_treeids - INTS** :
The id of the tree that this node is in.
* **class_weights - FLOATS** :
The weight for the class in class_id.
* **class_weights_as_tensor - TENSOR** :
The weight for the class in class_id.
* **classlabels_int64s - INTS** :
Class labels if using integer labels.
One and only one of the 'classlabels_*' attributes must be defined.
* **classlabels_strings - STRINGS** :
Class labels if using string labels.
One and only one of the 'classlabels_*' attributes must be defined.
* **nodes_falsenodeids - INTS** :
Child node if expression is false.
* **nodes_featureids - INTS** :
Feature id for each node.
* **nodes_hitrates - FLOATS** :
Popularity of each node, used for performance and may be omitted.
* **nodes_hitrates_as_tensor - TENSOR** :
Popularity of each node, used for performance and may be omitted.
* **nodes_missing_value_tracks_true - INTS** :
For each node, define what to do in the presence of a missing value: if a value is missing (NaN), use the 'true' or 'false' branch based on the value in this array.
This attribute may be left undefined, and the default value is false (0) for all nodes.
* **nodes_modes - STRINGS** :
The node kind, that is, the comparison to make at the node. There is no comparison to make at a leaf node.
One of 'BRANCH_LEQ', 'BRANCH_LT', 'BRANCH_GTE', 'BRANCH_GT', 'BRANCH_EQ', 'BRANCH_NEQ', 'LEAF'
* **nodes_nodeids - INTS** :
Node id for each node. Ids may restart at zero for each tree, but it not required to.
* **nodes_treeids - INTS** :
Tree id for each node.
* **nodes_truenodeids - INTS** :
Child node if expression is true.
* **nodes_values - FLOATS** :
Thresholds to do the splitting on for each node.
* **nodes_values_as_tensor - TENSOR** :
Thresholds to do the splitting on for each node.
* **post_transform - STRING** (default is `'NONE'`):
Indicates the transform to apply to the score.
One of 'NONE,' 'SOFTMAX,' 'LOGISTIC,' 'SOFTMAX_ZERO,' or 'PROBIT.'
### Inputs
- **X** (heterogeneous) - **T1**:
Input of shape [N,F]
### Outputs
- **Y** (heterogeneous) - **T2**:
N, Top class for each point
- **Z** (heterogeneous) - **tensor(float)**:
The class score for each class, for each point, a tensor of shape [N,E].
### Type Constraints
* **T1** in ( `tensor(double)`, `tensor(float)`, `tensor(int32)`, `tensor(int64)` ):
The input type must be a tensor of a numeric type.
* **T2** in ( `tensor(int64)`, `tensor(string)` ):
The output type will be a tensor of strings or integers, depending on which of the classlabels_* attributes is used.
```{toctree}
text_diff_TreeEnsembleClassifier_1_5
text_diff_TreeEnsembleClassifier_1_3
```
(l-onnx-opai-onnx-ml-treeensembleclassifier-1)=
## TreeEnsembleClassifier - 1 (ai.onnx.ml)
### Version
- **name**: [TreeEnsembleClassifier (GitHub)](https://github.com/onnx/onnx/blob/main/docs/Operators-ml.md#ai.onnx.ml.TreeEnsembleClassifier)
- **domain**: `ai.onnx.ml`
- **since_version**: `1`
- **function**: `False`
- **support_level**: `SupportType.COMMON`
- **shape inference**: `True`
This version of the operator has been available
**since version 1 of domain ai.onnx.ml**.
### Summary
Tree Ensemble classifier. Returns the top class for each of N inputs.
The attributes named 'nodes_X' form a sequence of tuples, associated by
index into the sequences, which must all be of equal length. These tuples
define the nodes.
Similarly, all fields prefixed with 'class_' are tuples of votes at the leaves.
A leaf may have multiple votes, where each vote is weighted by
the associated class_weights index.
One and only one of classlabels_strings or classlabels_int64s
will be defined. The class_ids are indices into this list.
### Attributes
* **base_values - FLOATS** :
Base values for classification, added to final class score; the size must be the same as the classes or can be left unassigned (assumed 0)
* **class_ids - INTS** :
The index of the class list that each weight is for.
* **class_nodeids - INTS** :
node id that this weight is for.
* **class_treeids - INTS** :
The id of the tree that this node is in.
* **class_weights - FLOATS** :
The weight for the class in class_id.
* **classlabels_int64s - INTS** :
Class labels if using integer labels.
One and only one of the 'classlabels_*' attributes must be defined.
* **classlabels_strings - STRINGS** :
Class labels if using string labels.
One and only one of the 'classlabels_*' attributes must be defined.
* **nodes_falsenodeids - INTS** :
Child node if expression is false.
* **nodes_featureids - INTS** :
Feature id for each node.
* **nodes_hitrates - FLOATS** :
Popularity of each node, used for performance and may be omitted.
* **nodes_missing_value_tracks_true - INTS** :
For each node, define what to do in the presence of a missing value: if a value is missing (NaN), use the 'true' or 'false' branch based on the value in this array.
This attribute may be left undefined, and the default value is false (0) for all nodes.
* **nodes_modes - STRINGS** :
The node kind, that is, the comparison to make at the node. There is no comparison to make at a leaf node.
One of 'BRANCH_LEQ', 'BRANCH_LT', 'BRANCH_GTE', 'BRANCH_GT', 'BRANCH_EQ', 'BRANCH_NEQ', 'LEAF'
* **nodes_nodeids - INTS** :
Node id for each node. Ids may restart at zero for each tree, but it not required to.
* **nodes_treeids - INTS** :
Tree id for each node.
* **nodes_truenodeids - INTS** :
Child node if expression is true.
* **nodes_values - FLOATS** :
Thresholds to do the splitting on for each node.
* **post_transform - STRING** (default is `'NONE'`):
Indicates the transform to apply to the score.
One of 'NONE,' 'SOFTMAX,' 'LOGISTIC,' 'SOFTMAX_ZERO,' or 'PROBIT.'
### Inputs
- **X** (heterogeneous) - **T1**:
Input of shape [N,F]
### Outputs
- **Y** (heterogeneous) - **T2**:
N, Top class for each point
- **Z** (heterogeneous) - **tensor(float)**:
The class score for each class, for each point, a tensor of shape [N,E].
### Type Constraints
* **T1** in ( `tensor(double)`, `tensor(float)`, `tensor(int32)`, `tensor(int64)` ):
The input type must be a tensor of a numeric type.
* **T2** in ( `tensor(int64)`, `tensor(string)` ):
The output type will be a tensor of strings or integers, depending on which of the classlabels_* attributes is used.