From 54cfaed5d307513cfd94a5807cf26a16695313ef Mon Sep 17 00:00:00 2001 From: dding3 Date: Fri, 6 May 2016 14:15:10 +0800 Subject: [PATCH 1/3] Improve LogisticRegression warning message --- .../apache/spark/ml/classification/LogisticRegression.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 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 d2d4e249b4208..2bf07a76f18b9 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 @@ -366,9 +366,9 @@ class LogisticRegression @Since("1.2.0") ( Vectors.zeros(if ($(fitIntercept)) numFeatures + 1 else numFeatures) if (optInitialModel.isDefined && optInitialModel.get.coefficients.size != numFeatures) { - val vec = optInitialModel.get.coefficients + val vecSize = optInitialModel.get.coefficients.size logWarning( - s"Initial coefficients provided $vec did not match the expected size $numFeatures") + s"Initial coefficients will be ignored!! As its size $vecSize did not match the expected size $numFeatures") } if (optInitialModel.isDefined && optInitialModel.get.coefficients.size == numFeatures) { From f9b88de0790ca22ab87c8f06bfe1f2f33966edd4 Mon Sep 17 00:00:00 2001 From: dding3 Date: Sat, 7 May 2016 09:53:20 +0800 Subject: [PATCH 2/3] fix Scala style tests error --- .../apache/spark/ml/classification/LogisticRegression.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 2bf07a76f18b9..7ab1283d71c1e 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 @@ -368,7 +368,8 @@ class LogisticRegression @Since("1.2.0") ( if (optInitialModel.isDefined && optInitialModel.get.coefficients.size != numFeatures) { val vecSize = optInitialModel.get.coefficients.size logWarning( - s"Initial coefficients will be ignored!! As its size $vecSize did not match the expected size $numFeatures") + s"Initial coefficients will be ignored!! As its size $vecSize did not match the " + + s"expected size $numFeatures") } if (optInitialModel.isDefined && optInitialModel.get.coefficients.size == numFeatures) { From 1b33456d59ea1c17b1aedd1d188a082a94b1eb98 Mon Sep 17 00:00:00 2001 From: dding3 Date: Sun, 8 May 2016 20:56:52 +0800 Subject: [PATCH 3/3] fix scala style test error --- .../apache/spark/ml/classification/LogisticRegression.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 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 7ab1283d71c1e..3e8040d3e9cdd 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 @@ -368,8 +368,8 @@ class LogisticRegression @Since("1.2.0") ( if (optInitialModel.isDefined && optInitialModel.get.coefficients.size != numFeatures) { val vecSize = optInitialModel.get.coefficients.size logWarning( - s"Initial coefficients will be ignored!! As its size $vecSize did not match the " + - s"expected size $numFeatures") + s"Initial coefficients will be ignored!! As its size $vecSize did not match the " + + s"expected size $numFeatures") } if (optInitialModel.isDefined && optInitialModel.get.coefficients.size == numFeatures) {