-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[Minor][MLLIB] Refactor toString method in MLLIB #5687
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
aihex
commented
Apr 24, 2015
- predict(predict.toString) has already output prefix “predict” thus it’s duplicated to print ", predict = " again
- there are some extra spaces
1. predict(predict.toString) has already output prefix “predict” thus it’s duplicate to print ", predict = " again 2. there are some extra spaces
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These can use string interpolation. I take your point though it breaks the symmetry a bit and make this toString rely on details of the subclass. How about making the Predict.toString return something more compact like s"$predict ($prob)"?
|
Modify Predict.scala and decouple the dependency of Node.scala on Predict.scala. |
|
I'm OK with this, though while you're at it, why not make these use string interpolation? |
|
If you're referring to the modification on Predict.scala, I just follow the style of previous code. |
|
Yes, but that's a hold over from Scala 2.9 and before. I think that while we're modifying these strings they can use the 'modern' style used in new code in the project. |
7fa27ae to
426eee7
Compare
Modify Predict.scala and decouple the dependency of Node.scala on Predict.scala
|
Okay, sounds better to use a modern style. |
|
... this still is not using string interpolation everywhere. It's a small thing, but if we're bothering to update these |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd put a space before the parenthesis: $predict (prob
Change to string interpolation way
|
Get your point and change all toString methods in MLLIB. |
|
Looks OK, I think Joseph just had one more tiny comment on one |
|
Good to go. |
|
ok to test |
|
LGTM pending tests |
|
Test build #699 has finished for PR 5687 at commit
|
|
@AIHE this fails style checks. I think the lines are too long. Can you fix those up and try |
b6380c6 to
44ba947
Compare
|
@srowen Sure. Pass the style checking and will do that for PRs in the feature. |
|
Test build #710 has finished for PR 5687 at commit
|
1. predict(predict.toString) has already output prefix “predict” thus it’s duplicated to print ", predict = " again 2. there are some extra spaces Author: Alain <[email protected]> Closes apache#5687 from AiHe/tree-node-issue-2 and squashes the following commits: 9862b9a [Alain] Pass scala coding style checking 44ba947 [Alain] Minor][MLLIB] Format toString method in MLLIB bdc402f [Alain] [Minor][MLLIB] Fix a formatting bug in toString method in Node 426eee7 [Alain] [Minor][MLLIB] Fix a formatting bug in toString method in Node.scala
1. predict(predict.toString) has already output prefix “predict” thus it’s duplicated to print ", predict = " again 2. there are some extra spaces Author: Alain <[email protected]> Closes apache#5687 from AiHe/tree-node-issue-2 and squashes the following commits: 9862b9a [Alain] Pass scala coding style checking 44ba947 [Alain] Minor][MLLIB] Format toString method in MLLIB bdc402f [Alain] [Minor][MLLIB] Fix a formatting bug in toString method in Node 426eee7 [Alain] [Minor][MLLIB] Fix a formatting bug in toString method in Node.scala