zhengruifeng commented on code in PR #50106: URL: https://github.com/apache/spark/pull/50106#discussion_r1982392072
########## mllib/src/main/scala/org/apache/spark/ml/classification/LogisticRegression.scala: ########## @@ -1041,6 +1041,24 @@ class LogisticRegression @Since("1.2.0") ( (solution, arrayBuilder.result()) } + private[spark] override def estimateModelSize(dataset: Dataset[_]): Long = { + // TODO: get numClasses and numFeatures together from dataset + val numClasses = DatasetUtils.getNumClasses(dataset, $(labelCol)) + val numFeatures = DatasetUtils.getNumFeatures(dataset, $(featuresCol)) + + var size = this.estimateMatadataSize + if (checkMultinomial(numClasses)) { + size += Matrices.getDenseSize(numFeatures, numClasses) // coefficientMatrix + size += Vectors.getDenseSize(numClasses) // interceptVector + } else { + size += Matrices.getDenseSize(numFeatures, 1) // coefficientMatrix + size += Vectors.getDenseSize(1) // interceptVector + } + size += java.lang.Integer.BYTES // numClasses + size += 1 // isMultinomial Review Comment: i am fine if we only focus on larger ones like vector/matrix/array -- 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