aboutsummaryrefslogtreecommitdiff
path: root/mllib
diff options
context:
space:
mode:
authordding3 <dingding@dingding-ubuntu.sh.intel.com>2016-05-09 09:43:07 +0100
committerSean Owen <sowen@cloudera.com>2016-05-09 09:43:07 +0100
commita78fbfa619a13421b294328b80c82510ca7efed0 (patch)
tree6740913b62ac057d5abda4d1f67a5d9af80486cf /mllib
parent12fe2ecd1998a8b01667aa1ab910a604b2aec4c8 (diff)
downloadspark-a78fbfa619a13421b294328b80c82510ca7efed0.tar.gz
spark-a78fbfa619a13421b294328b80c82510ca7efed0.tar.bz2
spark-a78fbfa619a13421b294328b80c82510ca7efed0.zip
[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 <dingding@dingding-ubuntu.sh.intel.com> Closes #12948 from dding3/master.
Diffstat (limited to 'mllib')
-rw-r--r--mllib/src/main/scala/org/apache/spark/ml/classification/LogisticRegression.scala5
1 files changed, 3 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 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) {