purijatin commented on a change in pull request #23549: [SPARK-26616][MLlib] 
Expose document frequency in IDFModel
URL: https://github.com/apache/spark/pull/23549#discussion_r248634577
 
 

 ##########
 File path: mllib/src/main/scala/org/apache/spark/ml/feature/IDF.scala
 ##########
 @@ -175,13 +185,25 @@ object IDFModel extends MLReadable[IDFModel] {
     private val className = classOf[IDFModel].getName
 
     override def load(path: String): IDFModel = {
+      import org.json4s.DefaultFormats
+      implicit val format = DefaultFormats
       val metadata = DefaultParamsReader.loadMetadata(path, sc, className)
+
       val dataPath = new Path(path, "data").toString
       val data = sparkSession.read.parquet(dataPath)
-      val Row(idf: Vector) = MLUtils.convertVectorColumnsToML(data, "idf")
-        .select("idf")
-        .head()
-      val model = new IDFModel(metadata.uid, new 
feature.IDFModel(OldVectors.fromML(idf)))
+      val model = if (majorVersion(metadata.sparkVersion) >= 3) {
 
 Review comment:
   I have committed a newer implementation that considers versioning of model 
instead of spark-version.
   Could you please review it? Thanks for the time and review.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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]

Reply via email to