You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by pseudo oduesp <ps...@gmail.com> on 2016/06/21 16:12:31 UTC

Labeledpoint

Hi,
i am pyspark user and i want test Randomforest.

i have dataframe with 100 columns
i should give Rdd or data frame to algorithme i transformed my dataframe to
only tow columns
label ands features  columns

 df.label df.features
  0            (517,(0,1,2,333,56 ...
   1           (517,(0,11,0,33,6 ...
    0           (517,(0,1,0,33,8 ...

but i dont have no ieda to transorme data frame like input to data frame i
test the example in offciel web page without succes

please give me example how i can work and specily with test set  .

thanks

Re: Labeledpoint

Posted by Ndjido Ardo BAR <nd...@gmail.com>.
To answer more accurately to your question, the model.fit(df) method takes
in a DataFrame of Row(label=double, feature=Vectors.dense([...])) .

cheers,
Ardo.


On Tue, Jun 21, 2016 at 6:44 PM, Ndjido Ardo BAR <nd...@gmail.com> wrote:

> Hi,
>
> You can use a RDD of LabelPoints to fit your model. Check the doc for more
> example :
> http://spark.apache.org/docs/latest/api/python/pyspark.ml.html?highlight=transform#pyspark.ml.classification.RandomForestClassificationModel.transform
>
> cheers,
> Ardo.
>
> On Tue, Jun 21, 2016 at 6:12 PM, pseudo oduesp <ps...@gmail.com>
> wrote:
>
>> Hi,
>> i am pyspark user and i want test Randomforest.
>>
>> i have dataframe with 100 columns
>> i should give Rdd or data frame to algorithme i transformed my dataframe
>> to only tow columns
>> label ands features  columns
>>
>>  df.label df.features
>>   0            (517,(0,1,2,333,56 ...
>>    1           (517,(0,11,0,33,6 ...
>>     0           (517,(0,1,0,33,8 ...
>>
>> but i dont have no ieda to transorme data frame like input to data frame
>> i test the example in offciel web page without succes
>>
>> please give me example how i can work and specily with test set  .
>>
>> thanks
>>
>
>

Re: Labeledpoint

Posted by Ndjido Ardo BAR <nd...@gmail.com>.
Hi,

You can use a RDD of LabelPoints to fit your model. Check the doc for more
example :
http://spark.apache.org/docs/latest/api/python/pyspark.ml.html?highlight=transform#pyspark.ml.classification.RandomForestClassificationModel.transform

cheers,
Ardo.

On Tue, Jun 21, 2016 at 6:12 PM, pseudo oduesp <ps...@gmail.com>
wrote:

> Hi,
> i am pyspark user and i want test Randomforest.
>
> i have dataframe with 100 columns
> i should give Rdd or data frame to algorithme i transformed my dataframe
> to only tow columns
> label ands features  columns
>
>  df.label df.features
>   0            (517,(0,1,2,333,56 ...
>    1           (517,(0,11,0,33,6 ...
>     0           (517,(0,1,0,33,8 ...
>
> but i dont have no ieda to transorme data frame like input to data frame i
> test the example in offciel web page without succes
>
> please give me example how i can work and specily with test set  .
>
> thanks
>