Skip to content

Commit

Permalink
removing test and style
Browse files Browse the repository at this point in the history
  • Loading branch information
sethah committed Apr 13, 2016
1 parent 6f6c2a1 commit a673658
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 23 deletions.
Expand Up @@ -125,7 +125,8 @@ private[spark] object RandomForest extends Logging {
val withReplacement = numTrees > 1

val baggedInput = BaggedPoint
.convertToBaggedRDD(treeInput, strategy.subsamplingRate, numTrees, withReplacement, seed = seed)
.convertToBaggedRDD(treeInput, strategy.subsamplingRate, numTrees, withReplacement,
seed = seed)
.persist(StorageLevel.MEMORY_AND_DISK)

// depth of the decision tree
Expand Down
Expand Up @@ -18,7 +18,6 @@
package org.apache.spark.ml.tree.impl

import org.apache.spark.SparkFunSuite
import org.apache.spark.mllib.regression.LabeledPoint
import org.apache.spark.mllib.tree.EnsembleTestHelper
import org.apache.spark.mllib.util.MLlibTestSparkContext

Expand Down Expand Up @@ -103,25 +102,4 @@ class BaggedPointSuite extends SparkFunSuite with MLlibTestSparkContext {
expectedStddev, epsilon = 0.01)
}
}

test("BaggedPoint RDD: with subsampling without replacement (fraction = 0.5) with weights") {
val numSubsamples = 100
val subsample = 0.5
val constantWeight = 0.1
val expectedMean = subsample * constantWeight
val expectedStddev = math.sqrt(subsample * (1 - subsample)) * constantWeight
val seeds = Array(123, 5354, 230, 349867, 23987)
val numSamples = 1000
val arr = EnsembleTestHelper.generateOrderedLabeledPoints(1, numSamples)
val rdd = sc.parallelize(arr)
seeds.foreach { seed =>
val baggedRDD =
BaggedPoint.convertToBaggedRDD(rdd, subsample, numSubsamples, false,
(lp: LabeledPoint) => constantWeight, seed = seed)
val subsampleCounts: Array[Array[Double]] =
baggedRDD.map(point => point.weightedCounts).collect()
EnsembleTestHelper.testRandomArrays(subsampleCounts, numSubsamples, expectedMean,
expectedStddev, epsilon = 0.01)
}
}
}

0 comments on commit a673658

Please sign in to comment.