diff --git a/mllib/src/main/scala/org/apache/spark/mllib/api/python/PythonMLLibAPI.scala b/mllib/src/main/scala/org/apache/spark/mllib/api/python/PythonMLLibAPI.scala index bf1c6a6fc77cc..8a220d93dd586 100644 --- a/mllib/src/main/scala/org/apache/spark/mllib/api/python/PythonMLLibAPI.scala +++ b/mllib/src/main/scala/org/apache/spark/mllib/api/python/PythonMLLibAPI.scala @@ -961,7 +961,7 @@ private[python] class PythonMLLibAPI extends Serializable { def estimateKernelDensity( sample: JavaRDD[Double], bandwidth: Double, points: java.util.ArrayList[Double]): Array[Double] = { - return new KernelDensity().setSample(sample).setBandwidth(bandwidth).estimate( + new KernelDensity().setSample(sample).setBandwidth(bandwidth).estimate( points.asScala.toArray) } @@ -985,20 +985,28 @@ private[python] class PythonMLLibAPI extends Serializable { */ def generateLinearInputWrapper( intercept: Double, - weights: JArrayList[Double], xMean: JArrayList[Double], - xVariance: JArrayList[Double], nPoints: Int, seed: Int, eps: Double): Array[LabeledPoint] = { - return LinearDataGenerator.generateLinearInput( - intercept, weights.asScala.toArray, xMean.asScala.toArray, - xVariance.asScala.toArray, nPoints, seed, eps).toArray + weights: JList[Double], + xMean: JList[Double], + xVariance: JList[Double], + nPoints: Int, + seed: Int, + eps: Double): Array[LabeledPoint] = { + LinearDataGenerator.generateLinearInput( + intercept, weights.asScala.toArray, xMean.asScala.toArray, + xVariance.asScala.toArray, nPoints, seed, eps).toArray } /** * Wrapper around the generateLinearRDD method of LinearDataGenerator. */ def generateLinearRDDWrapper( - sc: JavaSparkContext, nexamples: Int, nfeatures: Int, - eps: Double, nparts: Int, intercept: Double): JavaRDD[LabeledPoint] = { - return LinearDataGenerator.generateLinearRDD( + sc: JavaSparkContext, + nexamples: Int, + nfeatures: Int, + eps: Double, + nparts: Int, + intercept: Double): JavaRDD[LabeledPoint] = { + LinearDataGenerator.generateLinearRDD( sc, nexamples, nfeatures, eps, nparts, intercept) } } diff --git a/python/pyspark/mllib/util.py b/python/pyspark/mllib/util.py index 0dfad2e078b84..223bc8841f047 100644 --- a/python/pyspark/mllib/util.py +++ b/python/pyspark/mllib/util.py @@ -265,7 +265,7 @@ def generateLinearInput(intercept, weights, xMean, xVariance, nPoints, seed, eps): """ :param: intercept bias factor, the term c in X'w + c - :param: weights feature vector the term w in X'w + c + :param: weights feature vector, the term w in X'w + c :param: xMean Point around which the data X is centered. :param: xVariance Variance of the given data :param: nPoints Number of points to be generated