From 4bc1053cf56c3d6dca212cfbd75c3941c907806a Mon Sep 17 00:00:00 2001 From: Huaxin Gao Date: Thu, 16 Jul 2020 09:38:00 -0700 Subject: [PATCH] address comments --- .../org/apache/spark/ml/clustering/BisectingKMeans.scala | 8 ++------ .../org/apache/spark/ml/clustering/GaussianMixture.scala | 6 +----- .../scala/org/apache/spark/ml/clustering/KMeans.scala | 9 ++------- .../apache/spark/ml/regression/LinearRegression.scala | 2 -- python/pyspark/ml/classification.py | 1 - 5 files changed, 5 insertions(+), 21 deletions(-) diff --git a/mllib/src/main/scala/org/apache/spark/ml/clustering/BisectingKMeans.scala b/mllib/src/main/scala/org/apache/spark/ml/clustering/BisectingKMeans.scala index e83ccfb075a00..5a60bed2652f7 100644 --- a/mllib/src/main/scala/org/apache/spark/ml/clustering/BisectingKMeans.scala +++ b/mllib/src/main/scala/org/apache/spark/ml/clustering/BisectingKMeans.scala @@ -68,16 +68,12 @@ private[clustering] trait BisectingKMeansParams extends Params with HasMaxIter "The minimum number of points (if >= 1.0) or the minimum proportion " + "of points (if < 1.0) of a divisible cluster.", ParamValidators.gt(0.0)) - - setDefault( - k -> 4, - maxIter -> 20, - minDivisibleClusterSize -> 1.0) - /** @group expertGetParam */ @Since("2.0.0") def getMinDivisibleClusterSize: Double = $(minDivisibleClusterSize) + setDefault(k -> 4, maxIter -> 20, minDivisibleClusterSize -> 1.0) + /** * Validates and transforms the input schema. * @param schema input schema diff --git a/mllib/src/main/scala/org/apache/spark/ml/clustering/GaussianMixture.scala b/mllib/src/main/scala/org/apache/spark/ml/clustering/GaussianMixture.scala index 45dbf1a16cb29..996036e2d6330 100644 --- a/mllib/src/main/scala/org/apache/spark/ml/clustering/GaussianMixture.scala +++ b/mllib/src/main/scala/org/apache/spark/ml/clustering/GaussianMixture.scala @@ -59,11 +59,7 @@ private[clustering] trait GaussianMixtureParams extends Params with HasMaxIter w @Since("2.0.0") def getK: Int = $(k) - setDefault( - k -> 2, - maxIter -> 100, - tol -> 0.01, - blockSize -> 1) + setDefault(k -> 2, maxIter -> 100, tol -> 0.01, blockSize -> 1) /** * Validates and transforms the input schema. diff --git a/mllib/src/main/scala/org/apache/spark/ml/clustering/KMeans.scala b/mllib/src/main/scala/org/apache/spark/ml/clustering/KMeans.scala index 954c78f356936..5c06973e618bd 100644 --- a/mllib/src/main/scala/org/apache/spark/ml/clustering/KMeans.scala +++ b/mllib/src/main/scala/org/apache/spark/ml/clustering/KMeans.scala @@ -87,13 +87,8 @@ private[clustering] trait KMeansParams extends Params with HasMaxIter with HasFe @Since("1.5.0") def getInitSteps: Int = $(initSteps) - setDefault( - k -> 2, - maxIter -> 20, - initMode -> MLlibKMeans.K_MEANS_PARALLEL, - initSteps -> 2, - tol -> 1e-4, - distanceMeasure -> DistanceMeasure.EUCLIDEAN) + setDefault(k -> 2, maxIter -> 20, initMode -> MLlibKMeans.K_MEANS_PARALLEL, initSteps -> 2, + tol -> 1e-4, distanceMeasure -> DistanceMeasure.EUCLIDEAN) /** * Validates and transforms the input schema. diff --git a/mllib/src/main/scala/org/apache/spark/ml/regression/LinearRegression.scala b/mllib/src/main/scala/org/apache/spark/ml/regression/LinearRegression.scala index 1b16e4d89292b..235a7f9b6ebd5 100644 --- a/mllib/src/main/scala/org/apache/spark/ml/regression/LinearRegression.scala +++ b/mllib/src/main/scala/org/apache/spark/ml/regression/LinearRegression.scala @@ -220,8 +220,6 @@ class LinearRegression @Since("1.3.0") (@Since("1.3.0") override val uid: String @Since("1.5.0") def setStandardization(value: Boolean): this.type = set(standardization, value) - - /** * Set the ElasticNet mixing parameter. * For alpha = 0, the penalty is an L2 penalty. diff --git a/python/pyspark/ml/classification.py b/python/pyspark/ml/classification.py index 3ee3df1f9638e..463dbee9a3b77 100644 --- a/python/pyspark/ml/classification.py +++ b/python/pyspark/ml/classification.py @@ -604,7 +604,6 @@ def __init__(self, featuresCol="features", labelCol="label", predictionCol="pred super(LinearSVC, self).__init__() self._java_obj = self._new_java_obj( "org.apache.spark.ml.classification.LinearSVC", self.uid) - kwargs = self._input_kwargs self.setParams(**kwargs)