RandomDataSet

public class RandomDataSet

Undocumented

  • data

    Declaration

    Swift

    public var data: [[String]]
  • entropy of the dataset

    Declaration

    Swift

    public var entropy: Float?
  • infoGains provided by each feature

    Declaration

    Swift

    public var infoGains: Dictionary<RandomFeature, Float>
  • best feature to use to grow tree

    Declaration

    Swift

    public var splitFeature: RandomFeature
  • col num of target var

    Declaration

    Swift

    public var target: Int
  • standard deviation

    Declaration

    Swift

    public var stdDev: Float
  • giniImpurity of the data set

    Declaration

    Swift

    public var giniImpurity: Float?
  • Creates a Random DataSet

    Declaration

    Swift

    public init(data: [[String]], target: Int)

    Parameters

    data

    data with labels

    target

    column number of label

    Return Value

    DataSet

  • Returns if dataset has same target classification for all examples

    Declaration

    Swift

    public func homogenous() -> (Bool, String)

    Return Value

    • if dataset has same target classification for all examples
    • the target classification

  • Returns Coefficient of Standard Deviation

    Declaration

    Swift

    public func getCoeffDev() -> Float

    Return Value

    Coefficient of Standard Deviation as Float

  • Returns standard deviation of continous target variable

    Declaration

    Swift

    public func getTargetStdDev() -> Float

    Return Value

    standard deviation of target variable as Float

  • Returns mean of continous target variable

    Declaration

    Swift

    public func getTargetMean() -> Float

    Return Value

    mean of target variable as Float

  • Returns entropy of dataset and sets entropy

    Declaration

    Swift

    public func getEntropy() -> Float

    Return Value

    entropy of dataset as Float

  • Returns the bestFeature with max infoGain to be used in id3

    Declaration

    Swift

    public func getBestFeature(fromIndices: [Int]) -> RandomFeature

    Parameters

    fromIndices

    set of indices of features to be considered

    Return Value

    best feature

  • Returns the best gini feature i.e. minimum gini impurity

    Declaration

    Swift

    public func getGiniFeature(fromIndices: [Int]) -> RandomFeature

    Parameters

    fromIndices

    set of indices of features to be considered

    Return Value

    best feature

  • Returns the feature with most standard deviation reduction

    Declaration

    Swift

    public func getSplitFeature(fromIndices: [Int]) -> RandomFeature

    Parameters

    fromIndices

    set of indices of features to be considered

    Return Value

    feature

  • Returns gini impurity of the data set

    Declaration

    Swift

    public func getGiniImpurity() -> Float

    Return Value

    gini impurity of the data set as a Float