Repository: spark
Updated Branches:
  refs/heads/branch-2.0 47feebd13 -> 8fb087772


[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 <dingd...@dingding-ubuntu.sh.intel.com>

Closes #12948 from dding3/master.

(cherry picked from commit a78fbfa619a13421b294328b80c82510ca7efed0)
Signed-off-by: Xiangrui Meng <m...@databricks.com>


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

Branch: refs/heads/branch-2.0
Commit: 8fb087772d7e226a188e2f3298abb603fd3909ed
Parents: 47feebd
Author: dding3 <dingd...@dingding-ubuntu.sh.intel.com>
Authored: Mon May 9 09:43:07 2016 +0100
Committer: Xiangrui Meng <m...@databricks.com>
Committed: Thu May 19 23:18:40 2016 -0700

----------------------------------------------------------------------
 .../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/8fb08777/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 27380ca..0ab4459 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
@@ -367,9 +367,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: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to