org.apache.ignite.ml.tree.randomforest.data

## Class TreeNode

- java.lang.Object
- - org.apache.ignite.ml.tree.randomforest.data.TreeNode

- All Implemented Interfaces:
    Serializable, AutoCloseable, IgniteModel<Vector,Double>, Model<Vector,Double>

      public class TreeNode
      extends Object
      implements IgniteModel<Vector,Double>

  Decision tree node class.
  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `TreeNode.Type` Type of node.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TreeNode()`
    `TreeNode(long id, int treeId)` Create an instance of TreeNode.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getDepth()`
    `int` | `getFeatureId()`
    `NodeId` | `getId()`
    `double` | `getImpurity()`
    `TreeNode` | `getLeft()`
    `TreeNode` | `getRight()`
    `TreeNode.Type` | `getType()`
    `double` | `getVal()`
    `Double` | `predict(Vector features)` Make a prediction for the specified input arguments.
    `NodeId` | `predictNextNodeKey(Vector features)` Returns leaf node for feature vector in according to decision tree.
    `void` | `setImpurity(double impurity)`
    `void` | `setVal(double val)`
    `List<TreeNode>` | `toConditional(int featureId, double val)` Convert node to conditional node.
    `void` | `toLeaf(double val)` Convert node to leaf.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.apache.ignite.ml.IgniteModel

      `andBefore, andThen, andThen, close, combine, toString`

- - ### Constructor Detail

    - #### TreeNode

          public TreeNode(long id,
                          int treeId)

      Create an instance of TreeNode.
      Parameters:
        `id` - Id in according to breadth-first search ordering.
        `treeId` - Tree id.

    - #### TreeNode

          public TreeNode()

  - ### Method Detail

    - #### predict

          public Double predict(Vector features)

      Make a prediction for the specified input arguments.
      Specified by:
        `predict` in interface `Model<Vector,Double>`
      Parameters:
        `features` - Input arguments.
      Returns:
        Prediction result.

    - #### predictNextNodeKey

          public NodeId predictNextNodeKey(Vector features)

      Returns leaf node for feature vector in according to decision tree.
      Parameters:
        `features` - Features.
      Returns:
        Node.

    - #### toConditional

          public List<TreeNode> toConditional(int featureId,
                                              double val)

      Convert node to conditional node.
      Parameters:
        `featureId` - Feature id.
        `val` - Value.

    - #### toLeaf

          public void toLeaf(double val)

      Convert node to leaf.
      Parameters:
        `val` - Value.

    - #### getId

          public NodeId getId()

    - #### setVal

          public void setVal(double val)

    - #### getType

          public TreeNode.Type getType()

    - #### getVal

          public double getVal()

    - #### setImpurity

          public void setImpurity(double impurity)

    - #### getImpurity

          public double getImpurity()

      Returns:
        Impurity in current node.

    - #### getDepth

          public int getDepth()

      Returns:
        Depth of current node.

    - #### getFeatureId

          public int getFeatureId()

      Returns:
        Feature id.

    - #### getLeft

          public TreeNode getLeft()

      Returns:
        Right subtree.

    - #### getRight

          public TreeNode getRight()

      Returns:
        Left subtree.

2022 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.12.0
Release Date | : January 10 2022