Class Tree.Builder

  • Enclosing class:
    Tree

    public static class Tree.Builder
    extends java.lang.Object
    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • setFeatureNames

        public Tree.Builder setFeatureNames​(java.util.List<java.lang.String> featureNames)
      • setClassificationLabels

        public Tree.Builder setClassificationLabels​(java.util.List<java.lang.String> classificationLabels)
      • addJunction

        public TreeNode.Builder addJunction​(int nodeIndex,
                                            int featureIndex,
                                            boolean isDefaultLeft,
                                            double decisionThreshold)
        Add a decision node. Space for the child nodes is allocated
        Parameters:
        nodeIndex - Where to place the node. This is either 0 (root) or an existing child node index
        featureIndex - The feature index the decision is made on
        isDefaultLeft - Default left branch if the feature is missing
        decisionThreshold - The decision threshold
        Returns:
        The created node
      • addLeaf

        public Tree.Builder addLeaf​(int nodeIndex,
                                    double value)
        Sets the node at nodeIndex to a leaf node.
        Parameters:
        nodeIndex - The index as allocated by a call to addJunction(int, int, boolean, double)
        value - The prediction value
        Returns:
        this
      • build

        public Tree build()