aboutsummaryrefslogtreecommitdiff
path: root/mllib/src/main
diff options
context:
space:
mode:
authorXiangrui Meng <meng@databricks.com>2015-05-12 14:39:03 -0700
committerXiangrui Meng <meng@databricks.com>2015-05-12 14:39:03 -0700
commita4874b0d1820efd24071108434a4d89429473fe3 (patch)
tree2c7a40af55ae544374e86208bb0d71d272d4ccc8 /mllib/src/main
parent455551d1c6cc206ffe1ff5ac52ca0ed89c61653d (diff)
downloadspark-a4874b0d1820efd24071108434a4d89429473fe3.tar.gz
spark-a4874b0d1820efd24071108434a4d89429473fe3.tar.bz2
spark-a4874b0d1820efd24071108434a4d89429473fe3.zip
[SPARK-7571] [MLLIB] rename Math to math
`scala.Math` is deprecated since 2.8. This PR only touchs `Math` usages in MLlib. dbtsai Author: Xiangrui Meng <meng@databricks.com> Closes #6092 from mengxr/SPARK-7571 and squashes the following commits: fe8f8d3 [Xiangrui Meng] Math -> math
Diffstat (limited to 'mllib/src/main')
-rw-r--r--mllib/src/main/scala/org/apache/spark/ml/classification/LogisticRegression.scala4
-rw-r--r--mllib/src/main/scala/org/apache/spark/mllib/clustering/GaussianMixture.scala2
-rw-r--r--mllib/src/main/scala/org/apache/spark/mllib/optimization/NNLS.scala2
-rw-r--r--mllib/src/main/scala/org/apache/spark/mllib/stat/KernelDensity.scala4
4 files changed, 6 insertions, 6 deletions
diff --git a/mllib/src/main/scala/org/apache/spark/ml/classification/LogisticRegression.scala b/mllib/src/main/scala/org/apache/spark/ml/classification/LogisticRegression.scala
index 647226a0d1..93ba91167b 100644
--- a/mllib/src/main/scala/org/apache/spark/ml/classification/LogisticRegression.scala
+++ b/mllib/src/main/scala/org/apache/spark/ml/classification/LogisticRegression.scala
@@ -175,7 +175,7 @@ class LogisticRegression
* }}}
*/
initialWeightsWithIntercept.toArray(numFeatures)
- = Math.log(histogram(1).toDouble / histogram(0).toDouble)
+ = math.log(histogram(1).toDouble / histogram(0).toDouble)
}
val states = optimizer.iterations(new CachedDiffFunction(costFun),
@@ -285,7 +285,7 @@ class LogisticRegressionModel private[ml] (
} else if (t == 1.0) {
Double.PositiveInfinity
} else {
- Math.log(t / (1.0 - t))
+ math.log(t / (1.0 - t))
}
if (rawPrediction(1) > rawThreshold) 1 else 0
}
diff --git a/mllib/src/main/scala/org/apache/spark/mllib/clustering/GaussianMixture.scala b/mllib/src/main/scala/org/apache/spark/mllib/clustering/GaussianMixture.scala
index 568b653056..c88410ac0f 100644
--- a/mllib/src/main/scala/org/apache/spark/mllib/clustering/GaussianMixture.scala
+++ b/mllib/src/main/scala/org/apache/spark/mllib/clustering/GaussianMixture.scala
@@ -160,7 +160,7 @@ class GaussianMixture private (
var llhp = 0.0 // previous log-likelihood
var iter = 0
- while(iter < maxIterations && Math.abs(llh-llhp) > convergenceTol) {
+ while (iter < maxIterations && math.abs(llh-llhp) > convergenceTol) {
// create and broadcast curried cluster contribution function
val compute = sc.broadcast(ExpectationSum.add(weights, gaussians)_)
diff --git a/mllib/src/main/scala/org/apache/spark/mllib/optimization/NNLS.scala b/mllib/src/main/scala/org/apache/spark/mllib/optimization/NNLS.scala
index 4766f77082..64d52bae00 100644
--- a/mllib/src/main/scala/org/apache/spark/mllib/optimization/NNLS.scala
+++ b/mllib/src/main/scala/org/apache/spark/mllib/optimization/NNLS.scala
@@ -91,7 +91,7 @@ private[spark] object NNLS {
val dir = ws.dir
val lastDir = ws.lastDir
val res = ws.res
- val iterMax = Math.max(400, 20 * n)
+ val iterMax = math.max(400, 20 * n)
var lastNorm = 0.0
var iterno = 0
var lastWall = 0 // Last iteration when we hit a bound constraint.
diff --git a/mllib/src/main/scala/org/apache/spark/mllib/stat/KernelDensity.scala b/mllib/src/main/scala/org/apache/spark/mllib/stat/KernelDensity.scala
index 0deef11b45..79747cc5d7 100644
--- a/mllib/src/main/scala/org/apache/spark/mllib/stat/KernelDensity.scala
+++ b/mllib/src/main/scala/org/apache/spark/mllib/stat/KernelDensity.scala
@@ -32,7 +32,7 @@ private[stat] object KernelDensity {
// This gets used in each Gaussian PDF computation, so compute it up front
val logStandardDeviationPlusHalfLog2Pi =
- Math.log(standardDeviation) + 0.5 * Math.log(2 * Math.PI)
+ math.log(standardDeviation) + 0.5 * math.log(2 * math.Pi)
val (points, count) = samples.aggregate((new Array[Double](evaluationPoints.length), 0))(
(x, y) => {
@@ -66,6 +66,6 @@ private[stat] object KernelDensity {
val x0 = x - mean
val x1 = x0 / standardDeviation
val logDensity = -0.5 * x1 * x1 - logStandardDeviationPlusHalfLog2Pi
- Math.exp(logDensity)
+ math.exp(logDensity)
}
}