Github user mateiz commented on a diff in the pull request: https://github.com/apache/spark/pull/685#discussion_r12502540 --- Diff: mllib/src/main/scala/org/apache/spark/mllib/regression/LabeledPoint.scala --- @@ -27,6 +28,28 @@ import org.apache.spark.mllib.linalg.Vector */ case class LabeledPoint(label: Double, features: Vector) { override def toString: String = { - "LabeledPoint(%s, %s)".format(label, features) + Seq(label, features).mkString("(", ",", ")") + } +} + +object LabeledPoint { + /** + * Parses a string resulted from `LabeledPoint#toString` into + * an [[org.apache.spark.mllib.regression.LabeledPoint]]. + */ + def parse(s: String): LabeledPoint = { + if (s.startsWith("(") || s.startsWith(")")) { + NumericParser.parse(s) match { + case Seq(label: Double, numeric: Any) => + LabeledPoint(label, Vectors.parseNumeric(numeric)) + case other => + sys.error(s"Cannot parse $other.") + } + } else { // dense format used before v1.0 --- End diff -- Oh I see, we actually did; never mind.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---