spark-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Debasish Das <>
Subject LabeledPoint dump LibSVM if SparseVector
Date Sun, 11 May 2014 16:40:10 GMT

I need to change the toString on LabeledPoint to libsvm format so that I
can dump RDD[LabeledPoint] as a format that could be read by sparse
glmnet-R and other packages to benchmark mllib classification accuracy...

Basically I have to change the toString of LabeledPoint and toString of

Should I add it as a PR or is it already being added ?

I added these functions toLibSvm in my internal util class for now...

def toLibSvm(labelPoint: LabeledPoint): String = {

    labelPoint.label.toString + " " +


  def toLibSvm(features: SparseVector): String = {

    val indices = features.indices

    val values = features.values"
").replace(',', ':').replace("(", "").replace(")","")


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message