Skip to content

Commit 4c51912

Browse files
committed
precision rounding
1 parent f6dfc66 commit 4c51912

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

mllib/src/main/scala/org/apache/spark/ml/tuning/CrossValidator.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ class CrossValidator @Since("1.2.0") (@Since("1.4.0") override val uid: String)
132132
models(i) match {
133133
case w: MLWritable =>
134134
val path = new Path($(modelPath), epm(i).toSeq.map(p => p.param.name + "-" + p.value)
135-
.mkString("-") + s"-split$splitIndex-$metric")
135+
.mkString("-") + s"-split$splitIndex-${math.rint(metric * 1000) / 1000}")
136136
w.save(path.toString)
137137
case _ =>
138138
logWarning(models(i).uid + " did not implement MLWritable. Serialization omitted.")

mllib/src/main/scala/org/apache/spark/ml/tuning/TrainValidationSplit.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ class TrainValidationSplit @Since("1.5.0") (@Since("1.5.0") override val uid: St
127127
if (isDefined(modelPath)) {
128128
models(i) match {
129129
case w: MLWritable =>
130-
val path = new Path($(modelPath), epm(i).toSeq
131-
.map(p => p.param.name + "-" + p.value).mkString("-") + s"-$metric")
130+
val path = new Path($(modelPath), epm(i).toSeq.map(p => p.param.name + "-" + p.value)
131+
.mkString("-") + s"-${math.rint(metric * 1000) / 1000}")
132132
w.save(path.toString)
133133
case _ =>
134134
logWarning(models(i).uid + " did not implement MLWritable. Serialization omitted.")

0 commit comments

Comments
 (0)