jeudi 21 janvier 2016

How to form a LabeledPoint from another LabeledPoint replacing one of the values with random numbers in PySpark

I have a LabeledPoint label1 which has values such as (12,24),(-21.3,-17.49) and so on. No I want to form another LabeledPoint label2 which will have the 1st value as the 1st value from label1 but the second value should be at a random difference of +2or -2 from the 1st value. So like for (12,24) the label2 should have 12 as 1st value and for 2nd value a random number between 10 to 14 (+2 and -2 from 12).

How can I do that?




Aucun commentaire:

Enregistrer un commentaire