GradientBoostRegressor

public class GradientBoostRegressor

Undocumented

  • training data

    Declaration

    Swift

    public var data: [[String]]
  • column number of target var

    Declaration

    Swift

    public var target: Int
  • residuals

    Declaration

    Swift

    public var residualData: [[String]]
  • root for the regressor

    Declaration

    Swift

    public var root: Float
  • decision trees

    Declaration

    Swift

    public var trees: [DecisionTree]
  • iterations/num of trees to be created

    Declaration

    Swift

    public var limit: Int
  • learning rate for GBR

    Declaration

    Swift

    public var learningRate: Float
  • choice of regression vs. classification

    Declaration

    Swift

    public var using: String
  • initializer for AdaBoost Classifier

    Declaration

    Swift

    public init(data: [[String]], target: Int, till: Int, learningRate: Float = 0.1, using: String)

    Parameters

    data

    data with labels

    target

    column number of the labels

    Till

    number of stumps to be generated

    using

    max infoGain or min gini impurity for tree making

  • Creates the trees

    Declaration

    Swift

    public func boost()

    Return Value

    None

  • Updates residual data

    Declaration

    Swift

    public func updateResidualData()

    Return Value

    None

  • Predicts value for an example by getting all tree decisions

    Declaration

    Swift

    public func predict(this: [[String]]) -> String

    Return Value

    prediction as a string

  • Scores the booster’s accuracy on test data

    Declaration

    Swift

    public func score(testData: [[String]]) -> (Float, [String])

    Parameters

    testData

    test data as a 2D string array with feature header

    Return Value

    • accuracy of predictions as float
    • predictions as string array