From a78fbfa619a13421b294328b80c82510ca7efed0 Mon Sep 17 00:00:00 2001 From: dding3 Date: Mon, 9 May 2016 09:43:07 +0100 Subject: [SPARK-15172][ML] Explicitly tell user initial coefficients is ignored when size mismatch happened in LogisticRegression ## What changes were proposed in this pull request? Explicitly tell user initial coefficients is ignored if its size doesn't match expected size in LogisticRegression ## How was this patch tested? local build Author: dding3 Closes #12948 from dding3/master. --- .../org/apache/spark/ml/classification/LogisticRegression.scala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'mllib') 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 d2d4e249b4..3e8040d3e9 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,10 @@ 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 " + + s"expected size $numFeatures") } if (optInitialModel.isDefined && optInitialModel.get.coefficients.size == numFeatures) { -- cgit v1.2.3