-
Notifications
You must be signed in to change notification settings - Fork 28.5k
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
[SPARK-8525][MLLIB] fix LabeledPoint parser when there is a whitespace between label and features vector #6954
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,11 @@ class LabeledPointSuite extends SparkFunSuite { | |
} | ||
} | ||
|
||
test("parse labeled points with whitespaces") { | ||
val point = LabeledPoint.parse("(0.0, [1.0, 2.0])") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm, doesn't this still yield There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When it comes to java.lang.Double.parseDouble(s) it ignores spaces. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, interesting. Sounds good. |
||
assert(point === LabeledPoint(0.0, Vectors.dense(1.0, 2.0))) | ||
} | ||
|
||
test("parse labeled points with v0.9 format") { | ||
val point = LabeledPoint.parse("1.0,1.0 0.0 -2.0") | ||
assert(point === LabeledPoint(1.0, Vectors.dense(1.0, 0.0, -2.0))) | ||
|
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.
Don't use commons-lang -- it's not actually a dependency. I wouldn't even use lang3. You don't need a utility class for something this simple