Node

public class Node

Undocumented

  • feature name or value (if leaf) stored in the node

    Declaration

    Swift

    public var classification: String
  • whether node is a leaf or not

    Declaration

    Swift

    public var isLeaf: Bool
  • parent node of the node

    Declaration

    Swift

    public weak var parent: Node?
  • used for splitting continous vars

    Declaration

    Swift

    public var cutoff: Float?
  • array of branches ot children

    Declaration

    Swift

    public var branches: [Branch]
  • creates a node

    Declaration

    Swift

    public init(classification: String, isLeaf: Bool)

    Parameters

    classification

    feature name or value (if leaf) stored in the node

    isLeaf

    whether node is a leaf or not

    Return Value

    Node

  • Adds a child by linking two nodes with a branch

    Declaration

    Swift

    public func addChild(label: String, node: Node)

    Parameters

    label

    feature value

    node

    the child node

    Return Value

    None

  • Adds a fork by linking two nodes with a branch - used for continous vars

    Declaration

    Swift

    public func addFork(label: String, node: Node, cutoff: Float)

    Parameters

    label

    feature value

    node

    the child node

    cutoff

    more or less than cutoff values

    Return Value

    None