RandomForest
public class RandomForest
Undocumented
-
Undocumented
Declaration
Swift
public var forest: [RandomTree] -
Undocumented
Declaration
Swift
public var fullData: [[String]] -
Undocumented
Declaration
Swift
public var target: Int -
Undocumented
Declaration
Swift
public var nTrees: Int -
Undocumented
Declaration
Swift
public var nFeatures: Int -
Undocumented
Declaration
Swift
public var depth: Int -
Undocumented
Declaration
Swift
public var perform: String -
Undocumented
Declaration
Swift
public var using: String -
Undocumented
Declaration
Swift
public var tolerance: Float -
Initializer for Random Forest
Declaration
Swift
public init (data: [[String]], target: Int, perform: String, using: String, nTrees: Int, nFeatures: Int, depth: Int, tolerance: Float = 0.1)Parameters
datadata with labels
targetlabel column number
performregression or classification
usingginiIndex or infoGain
nTreesnumber of Trees
Return Value
Random Forest
-
Makes the forest using bootstrapped data
Declaration
Swift
public func make()Return Value
None
-
Returns bootstrapped and out of bootData
Declaration
Swift
public func splitData(from: [[String]]) -> ([[String]], [[String]])Parameters
fromstring array of data
Return Value
boostrapped data and out of boot data
-
Classfies/Predicts an example by using all trees in the foret
Declaration
Swift
public func predict(this: [[String]]) -> StringReturn Value
classification/predictions as a string
-
Scores the random forest’s accuracy on test data
Declaration
Swift
public func score(with: [[String]]) -> (Float, [String])Parameters
testDatatest data as a 2D string array with feature header
Return Value
- accuracy of classifications as float
- classifications as string array
RandomForest Class Reference