BIDMach.models

RandomForest

class RandomForest extends Model

Random Forests. Given a datasource of data and labels, compute a random classification or regression Forest.

* Options

NOTE: The algorithm uses a packed representation of the dataset statistics with fixed precision fields. Setting nbits selects how many bits to use from each input data. For integer data, the lower nbits are used. For floating point data, the leading nbits are used. So e.g. 16 float bits gives sign, 8 bits of exponent, and 7 bits of mantissa with a leading 1.

For regression, discrete (integer) target values should be used in the training data. The output will be continuous values interpolated from them.

Other key parameters inherited from the learner, datasource and updater:

Example:

a is an nfeats x ninstances data matrix, c is a 1 x ninstances vector of labels

val (nn, opts) = RandomForest.learner(a,c)
opts.what             // prints the available options
opts.depth=25         // Set depth - something like log2(ninstances / 10) is good
opts.ntrees=20        // Good starting value. Increasing this usually increases accuracy.
opts.nsamps=30        // Typically sqrt(nfeats) is good. Larger values may work better.
opts.nnodes           // Bounded by 2^depth, but usually smaller than this.
opts.ncats=10         // Its a good idea to set this - learner will try to guess it, but may get it wrong
opts.nbits=10         // Number of bits to use from input data.
nn.train              // train the learner.
nn.modelmats          // get the final model (4 matrices)
Linear Supertypes
Model, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. RandomForest
  2. Model
  3. AnyRef
  4. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new RandomForest(opts: Opts = new RandomForest.Options)

Type Members

  1. trait imptyType extends AnyRef

Value Members

  1. final def !=(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  4. val ICat: Int

  5. val IFeat: Int

  6. val INode: Int

  7. val ITree: Int

  8. val IVFeat: Int

  9. val JFeat: Int

  10. var _modelmats: Array[Mat]

    Definition Classes
    Model
  11. def addSVecs(a: Array[SVec], totals: Array[SVTree]): Unit

  12. def addV(ind1: LMat, counts1: IMat, ind2: LMat, counts2: IMat): (LMat, IMat)

  13. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  14. var batchSize: Int

  15. def bind(ds: DataSource): Unit

    Definition Classes
    Model
  16. var blockv: SVec

  17. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  18. def copyMats(from: Array[Mat], to: Array[Mat]): Unit

    Definition Classes
    Model
  19. def copyTo(mod: Model): Unit

    Definition Classes
    Model
  20. def copycounts(cnts: IMat, tmpc: IMat): IMat

  21. def copyinds(inds: LMat, tmp: LMat): LMat

  22. def countV(ind1: LMat, counts1: IMat, ind2: LMat, counts2: IMat): Int

  23. var ctrees: FMat

  24. var datasource: DataSource

    Definition Classes
    Model
  25. def doblock(gmats: Array[Mat], ipass: Int, i: Long): Unit

    Definition Classes
    RandomForestModel
  26. def doblockg(amats: Array[Mat], ipass: Int, here: Long): Unit

    Definition Classes
    Model
  27. object entImpurity extends imptyType

  28. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  29. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  30. def evalblock(mats: Array[Mat], ipass: Int, here: Long): FMat

    Definition Classes
    RandomForestModel
  31. def evalblockg(amats: Array[Mat], ipass: Int, here: Long): FMat

    Definition Classes
    Model
  32. def extractAbove(fieldNum: Int, packedFields: Long, fieldshifts: Array[Int]): Int

    Annotations
    @inline()
  33. def extractField(fieldNum: Int, packedFields: Long, fieldshifts: Array[Int], fieldmasks: Array[Int]): Int

    Annotations
    @inline()
  34. val fieldlengths: IMat

  35. var fieldmasks: Array[Int]

  36. var fieldshifts: Array[Int]

  37. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  38. def findBoundaries(keys: LMat, jc: IMat): (IMat, IMat)

  39. def findIndex(blockv: SVec, itree: Int): Int

  40. def floatConvert(a: Float): Int

    Annotations
    @inline()
  41. def floatConvert2(a: Float): Int

    Annotations
    @inline()
  42. var ftrees: IMat

  43. def gaddV(gix: GLMat, gcx: GIMat, gmidinds: GLMat, gmidcounts: GIMat, gmergedinds: GLMat, gmergedcounts: GIMat): (GLMat, GIMat)

  44. var gains: FMat

  45. var gctrees: GMat

  46. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  47. def getFieldMasks(fL: IMat): Array[Int]

  48. def getFieldShifts(fL: IMat): Array[Int]

  49. def getSum(totals: Array[SVTree]): Array[SVec]

  50. var gfieldlengths: GIMat

  51. var gfnodes: GMat

  52. var gftree: GIMat

  53. var gftrees: GIMat

  54. object giniImpurity extends imptyType

  55. var gitree: GIMat

  56. var gitrees: GIMat

  57. def gjfeatsToIfeats(itree: Int, inodes: IMat, ifeats: IMat, seed: Int, gitree: GIMat, gftree: GIMat): Unit

  58. def gmakeV(keys: GLMat, vals: GIMat, tmpkeys: GLMat, tmpcounts: GIMat): SVec

  59. var gmats: Array[Mat]

    Definition Classes
    Model
  60. var gout: GLMat

  61. var gpiones: GIMat

  62. def gpsort(gout: GLMat): Int

  63. var gtmpcounts: GIMat

  64. var gtmpinds: GLMat

  65. var gtnodes: GIMat

  66. def gtreePack(gdata: GMat, gtnodes: GIMat, gcats: GMat, gout: GLMat, seed: Int): GLMat

  67. def gtreePack(gdata: GMat, gtnodes: GIMat, gcats: GIMat, gout: GLMat, seed: Int): GLMat

  68. def gtreePack(fdata: FMat, tnodes: IMat, icats: IMat, gout: GLMat, seed: Int): GLMat

  69. def gtreeStep(gdata: GMat, tnodes: GIMat, fnodes: GMat, itrees: GIMat, ftrees: GIMat, vtrees: GIMat, ctrees: GMat, getcat: Boolean): Unit

  70. def gtreeWalk(fdata: GMat, tnodes: GIMat, fnodes: GMat, itrees: GIMat, ftrees: GIMat, vtrees: GIMat, ctrees: GMat, depth: Int, getcat: Boolean): Unit

  71. var gvtrees: GIMat

  72. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  73. var igains: FMat

  74. val imptyFunArray: Array[imptyType]

  75. def init(): Unit

    Definition Classes
    RandomForestModel
  76. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  77. var itrees: IMat

  78. var jc: IMat

  79. def jfeatsToIfeats(itree: Int, inodes: IMat, ifeats: IMat, seed: Int, gitree: GIMat, gftree: GIMat): Unit

  80. var lens0: Long

  81. var lens1: Long

  82. def load(fname: String): Unit

  83. var lout: LMat

  84. final val magnitude: Int

  85. def makeV(ind: LMat): SVec

  86. var mats: Array[Mat]

    Definition Classes
    Model
  87. def minImpurity(keys: LMat, cnts: IMat, outv: IMat, outf: IMat, outn: IMat, outg: FMat, outc: FMat, outleft: FMat, outright: FMat, jc: IMat, jtree: IMat, itree: Int, fnum: Int, regression: Boolean): (FMat, Double)

  88. def minImpurity_thread(keys: LMat, cnts: IMat, outv: IMat, outf: IMat, outn: IMat, outg: FMat, outc: FMat, outleft: FMat, outright: FMat, jc: IMat, jtree: IMat, itree: Int, fnum: Int, regression: Boolean, ithread: Int, nthreads: Int): (FMat, Double)

  89. def minImpurityx(keys: LMat, cnts: IMat, outv: IMat, outf: IMat, outn: IMat, outg: FMat, outc: FMat, outleft: FMat, outright: FMat, jc: IMat, jtree: IMat, itree: Int, fnum: Int, regression: Boolean): (FMat, Double)

  90. def modelmats: Array[Mat]

    Definition Classes
    Model
  91. var nbits: Int

  92. var ncats: Int

  93. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  94. var nfeats: Int

  95. var nnodes: Int

  96. var nodecounts: IMat

  97. final def notify(): Unit

    Definition Classes
    AnyRef
  98. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  99. var nsamps: Int

  100. var ntrees: Int

  101. val opts: Opts

    Definition Classes
    RandomForestModel
  102. var outc: FMat

  103. var outf: IMat

  104. var outg: FMat

  105. var outleft: FMat

  106. var outn: IMat

  107. var outright: FMat

  108. var outv: IMat

  109. def packFields(itree: Int, inode: Int, jfeat: Int, ifeat: Int, ivfeat: Int, icat: Int, fieldlengths: Array[Int]): Long

    Annotations
    @inline()
  110. var parent_model: Model

    Definition Classes
    Model
  111. var putBack: Int

    Definition Classes
    Model
  112. var refresh: Boolean

    Definition Classes
    Model
  113. def regressVar(sumsq: Double, tott: Int, acc: Double, tot: Int, acct: Double, tot2: Int): Double

  114. def rhash(v1: Int, v2: Int, v3: Int, v4: Int, nb: Int): Int

    Annotations
    @inline()
  115. def rhash(v1: Int, v2: Int, v3: Int, nb: Int): Int

    Annotations
    @inline()
  116. val runtimes: FMat

  117. def save(fname: String): Unit

  118. var seed: Int

  119. def setmodelmats(a: Array[Mat]): Unit

    Definition Classes
    Model
  120. final val signbit: Int

  121. def splittableNodes(blockv: SVec): Array[SVec]

  122. def splittableNodes_thread(blockv: SVec, itree: Int): SVec

  123. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  124. var t0: Float

  125. var t1: Float

  126. var t2: Float

  127. var t3: Float

  128. var t4: Float

  129. var t5: Float

  130. var t6: Float

  131. def tally(nodes: FMat): IMat

  132. def tallyv(nodes: FMat): FMat

  133. def toString(): String

    Definition Classes
    AnyRef → Any
  134. def tochildren(itree: Int, inodes: IMat, left: FMat, right: FMat): Unit

  135. var totals: Array[SVTree]

  136. def treePack(fdata: FMat, treenodes: IMat, fcats: FMat, out: LMat, seed: Int): LMat

  137. def treePack(fdata: FMat, treenodes: IMat, cats: IMat, out: LMat, seed: Int): LMat

  138. def treeStep(fdata: FMat, tnodes: IMat, fnodes: FMat, itrees: IMat, ftrees: IMat, vtrees: IMat, ctrees: FMat, getcat: Boolean): Unit

  139. def treeWalk(fdata: FMat, tnodes: IMat, fnodes: FMat, itrees: IMat, ftrees: IMat, vtrees: IMat, ctrees: FMat, depth: Int, getcat: Boolean): FMat

  140. def unpackFields(im: Long, fieldlengths: Array[Int]): (Int, Int, Int, Int, Int, Int)

    Annotations
    @inline()
  141. def updatePass(ipass: Int): Unit

    Definition Classes
    RandomForestModel
  142. var updatemats: Array[Mat]

    Definition Classes
    Model
  143. var useDouble: Boolean

    Definition Classes
    Model
  144. var useGPU: Boolean

    Definition Classes
    Model
  145. var useIfeats: Boolean

  146. var vtrees: IMat

  147. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  148. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  149. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  150. var x: Mat

  151. var xnodes: IMat

  152. var y: Mat

  153. var ynodes: FMat

Inherited from Model

Inherited from AnyRef

Inherited from Any

Ungrouped