Repository: spark
Updated Branches:
  refs/heads/master 12fe2ecd1 -> a78fbfa61


[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 <[email protected]>

Closes #12948 from dding3/master.


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/a78fbfa6
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/a78fbfa6
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/a78fbfa6

Branch: refs/heads/master
Commit: a78fbfa619a13421b294328b80c82510ca7efed0
Parents: 12fe2ec
Author: dding3 <[email protected]>
Authored: Mon May 9 09:43:07 2016 +0100
Committer: Sean Owen <[email protected]>
Committed: Mon May 9 09:43:07 2016 +0100

----------------------------------------------------------------------
 .../org/apache/spark/ml/classification/LogisticRegression.scala | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/a78fbfa6/mllib/src/main/scala/org/apache/spark/ml/classification/LogisticRegression.scala
----------------------------------------------------------------------
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 d2d4e24..3e8040d 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) {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to