zeotuan commented on code in PR #46151:
URL: https://github.com/apache/spark/pull/46151#discussion_r1574581536


##########
mllib/src/main/scala/org/apache/spark/ml/tuning/CrossValidator.scala:
##########
@@ -192,12 +193,13 @@ class CrossValidator @Since("1.2.0") (@Since("1.4.0") 
override val uid: String)
       foldMetrics
     }.transpose.map(_.sum / $(numFolds)) // Calculate average metric over all 
splits
 
-    instr.logInfo(s"Average cross-validation metrics: 
${metrics.toImmutableArraySeq}")
+    instr.logInfo(log"Average cross-validation metrics: ${MDC(
+      CROSS_VALIDATION_METRICS, metrics.mkString("[", ", ", "]"))}")
     val (bestMetric, bestIndex) =
       if (eval.isLargerBetter) metrics.zipWithIndex.maxBy(_._1)
       else metrics.zipWithIndex.minBy(_._1)
-    instr.logInfo(s"Best set of parameters:\n${epm(bestIndex)}")
-    instr.logInfo(s"Best cross-validation metric: $bestMetric.")
+    instr.logInfo(log"Best set of parameters:\n${MDC(ESTIMATOR_PARAMETER_MAP, 
epm(bestIndex))}")

Review Comment:
   Wonder if there is a guideline on how to deal with more complex data 
structures? ex. HashMap, Seq of case class ?
   The only example I saw is `logWarning(log"BatchedWriteAheadLog Writer failed 
to write ${MDC(RECORDS, buffer)}", e)`



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to