viirya 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_r357863990
##########
File path:
mllib/src/main/scala/org/apache/spark/ml/classification/MultilayerPerceptronClassifier.scala
##########
@@ -369,11 +377,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 columns = sparkSession.read.parquet(dataPath).columns
Review comment:
Hmm, I think we can read from the data path in any case. Then we check the
length of returned array to decide we should read layers + weights or only
weights. We do not need to read the data twice.
----------------------------------------------------------------
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]