Skip to content

Commit b064714

Browse files
committed
remove computeStat in MLUtils
1 parent cbbefdb commit b064714

File tree

2 files changed

+3
-17
lines changed

2 files changed

+3
-17
lines changed

mllib/src/main/scala/org/apache/spark/mllib/util/MLUtils.scala

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,13 @@
1717

1818
package org.apache.spark.mllib.util
1919

20-
import breeze.linalg.{Vector => BV, DenseVector => BDV, SparseVector => BSV,
21-
squaredDistance => breezeSquaredDistance}
20+
import breeze.linalg.{Vector => BV, SparseVector => BSV, squaredDistance => breezeSquaredDistance}
2221

2322
import org.apache.spark.annotation.Experimental
2423
import org.apache.spark.SparkContext
2524
import org.apache.spark.rdd.RDD
2625
import org.apache.spark.mllib.regression.LabeledPoint
27-
import org.apache.spark.mllib.linalg.{Vector, Vectors}
26+
import org.apache.spark.mllib.linalg.Vectors
2827

2928
/**
3029
* Helper methods to load, save and pre-process data used in ML Lib.
@@ -170,7 +169,7 @@ object MLUtils {
170169
* xColMean - Row vector with mean for every column (or feature) of the input data
171170
* xColSd - Row vector standard deviation for every column (or feature) of the input data.
172171
*/
173-
private[mllib] def computeStats(
172+
def computeStats(
174173
data: RDD[LabeledPoint],
175174
numFeatures: Int,
176175
numExamples: Long): (Double, Vector, Vector) = {

mllib/src/test/scala/org/apache/spark/mllib/util/MLUtilsSuite.scala

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import com.google.common.base.Charsets
2727
import com.google.common.io.Files
2828

2929
import org.apache.spark.mllib.linalg.Vectors
30-
import org.apache.spark.mllib.regression.LabeledPoint
3130
import org.apache.spark.mllib.util.MLUtils._
3231

3332
class MLUtilsSuite extends FunSuite with LocalSparkContext {
@@ -56,18 +55,6 @@ class MLUtilsSuite extends FunSuite with LocalSparkContext {
5655
}
5756
}
5857

59-
test("compute stats") {
60-
val data = Seq.fill(3)(Seq(
61-
LabeledPoint(1.0, Vectors.dense(1.0, 2.0, 3.0)),
62-
LabeledPoint(0.0, Vectors.dense(3.0, 4.0, 5.0))
63-
)).flatten
64-
val rdd = sc.parallelize(data, 2)
65-
val (meanLabel, mean, std) = MLUtils.computeStats(rdd, 3, 6)
66-
assert(meanLabel === 0.5)
67-
assert(mean === Vectors.dense(2.0, 3.0, 4.0))
68-
assert(std === Vectors.dense(1.0, 1.0, 1.0))
69-
}
70-
7158
test("loadLibSVMData") {
7259
val lines =
7360
"""

0 commit comments

Comments
 (0)