zhengruifeng commented on a change in pull request #26838:
[SPARK-30144][ML][PySpark] Make MultilayerPerceptronClassificationModel extend
MultilayerPerceptronParams
URL: https://github.com/apache/spark/pull/26838#discussion_r358654420
##########
File path:
mllib/src/main/scala/org/apache/spark/ml/classification/MultilayerPerceptronClassifier.scala
##########
@@ -369,11 +361,18 @@ object MultilayerPerceptronClassificationModel
val metadata = DefaultParamsReader.loadMetadata(path, sc, className)
val dataPath = new Path(path, "data").toString
- val data = sparkSession.read.parquet(dataPath).select("layers",
"weights").head()
- val layers = data.getAs[Seq[Int]](0).toArray
- val weights = data.getAs[Vector](1)
- val model = new MultilayerPerceptronClassificationModel(metadata.uid,
layers, weights)
-
+ val df = sparkSession.read.parquet(dataPath)
+ val model = if (df.columns.length == 2) { // model prior to 3.0.0
Review comment:
totally nit: why not using version info in var `metadata` like other algs?
I guess we can fetch the main version from it even if the params are not
saved in it in the old version.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]