Repository: spark Updated Branches: refs/heads/master d85bb10ce -> 60398dabc
[SPARK-16130][ML] model loading backward compatibility for ml.classfication.LogisticRegression ## What changes were proposed in this pull request? jira: https://issues.apache.org/jira/browse/SPARK-16130 model loading backward compatibility for ml.classfication.LogisticRegression ## How was this patch tested? existing ut and manual test for loading old models. Author: Yuhao Yang <hhb...@gmail.com> Closes #13841 from hhbyyh/lrcomp. Project: http://git-wip-us.apache.org/repos/asf/spark/repo Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/60398dab Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/60398dab Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/60398dab Branch: refs/heads/master Commit: 60398dabc50d402bbab4190fbe94ebed6d3a48dc Parents: d85bb10 Author: Yuhao Yang <hhb...@gmail.com> Authored: Thu Jun 23 11:00:00 2016 -0700 Committer: Xiangrui Meng <m...@databricks.com> Committed: Thu Jun 23 11:00:00 2016 -0700 ---------------------------------------------------------------------- .../spark/ml/classification/LogisticRegression.scala | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/spark/blob/60398dab/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 be69d46..9c9f5ce 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 @@ -674,12 +674,12 @@ object LogisticRegressionModel extends MLReadable[LogisticRegressionModel] { val dataPath = new Path(path, "data").toString val data = sparkSession.read.format("parquet").load(dataPath) - .select("numClasses", "numFeatures", "intercept", "coefficients").head() + // We will need numClasses, numFeatures in the future for multinomial logreg support. - // val numClasses = data.getInt(0) - // val numFeatures = data.getInt(1) - val intercept = data.getDouble(2) - val coefficients = data.getAs[Vector](3) + val Row(numClasses: Int, numFeatures: Int, intercept: Double, coefficients: Vector) = + MLUtils.convertVectorColumnsToML(data, "coefficients") + .select("numClasses", "numFeatures", "intercept", "coefficients") + .head() val model = new LogisticRegressionModel(metadata.uid, coefficients, intercept) DefaultParamsReader.getAndSetParams(model, metadata) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org