spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sean Owen <so...@cloudera.com>
Subject Re: Extracting an element from the feature vector in LabeledPoint
Date Fri, 01 Aug 2014 10:19:37 GMT
If you look at the class LabeledPoint, you'll see it has a field called "label":

data.label

data.features(1) would access the second element of features, which is
not the same thing.

On Fri, Aug 1, 2014 at 3:01 AM, SK <skrishna.id@gmail.com> wrote:
>
> Hi,
>
> I want to extract the individual elements of a feature vector that is part
> of a LabeledPoint. I tried the following:
>
> data.features._1
> data.features(1)
> data.features.map(_.1)
>
>
> data is a LabeledPoint with a feature vector containing 3 features. All of
> the above resulted in  compilation errors. What is the right way to extract
> the elements of the feature vector?
>
> thanks
>
>
>
> --
> View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/Extracting-an-element-from-the-feature-vector-in-LabeledPoint-tp11110.html
> Sent from the Apache Spark User List mailing list archive at Nabble.com.

Mime
View raw message