zhengruifeng commented on code in PR #50106:
URL: https://github.com/apache/spark/pull/50106#discussion_r1982391327


##########
mllib/src/main/scala/org/apache/spark/ml/classification/FMClassifier.scala:
##########
@@ -312,6 +322,18 @@ class FMClassificationModel private[classification] (
     copyValues(new FMClassificationModel(uid, intercept, linear, factors), 
extra)
   }
 
+  override def estimatedSize: Long = {
+    var size = this.estimateMatadataSize
+    size += java.lang.Double.BYTES // intercept
+    if (this.linear != null) {
+      size += this.linear.getSizeInBytes
+    }
+    if (this.factors != null) {
+      size += this.factors.getSizeInBytes
+    }
+    size
+  }

Review Comment:
   because the model coefficient is available here, so we directly use `Matrix. 
getSizeInBytes` which support both sparse matrix and dense matrix.
   
   While in `estimateModelSize` we only know the shape of the matrix



-- 
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.

To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to