Skip to content

Commit bdc402f

Browse files
author
Alain
committed
[Minor][MLLIB] Fix a formatting bug in toString method in Node
Modify Predict.scala and decouple the dependency of Node.scala on Predict.scala
1 parent 426eee7 commit bdc402f

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

mllib/src/main/scala/org/apache/spark/mllib/tree/model/Node.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class Node (
5151
var stats: Option[InformationGainStats]) extends Serializable with Logging {
5252

5353
override def toString: String = {
54-
"id = " + id + ", isLeaf = " + isLeaf + ", " + predict + ", " +
54+
"id = " + id + ", isLeaf = " + isLeaf + ", predict = " + predict + ", " +
5555
"impurity = " + impurity + ", split = " + split + ", stats = " + stats
5656
}
5757

mllib/src/main/scala/org/apache/spark/mllib/tree/model/Predict.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ class Predict(
2929
val predict: Double,
3030
val prob: Double = 0.0) extends Serializable {
3131

32-
override def toString: String = {
33-
"predict = %f, prob = %f".format(predict, prob)
34-
}
32+
override def toString: String = s"$predict(prob = $prob)"
3533

3634
override def equals(other: Any): Boolean = {
3735
other match {

0 commit comments

Comments
 (0)