You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by "Devi P.V" <de...@gmail.com> on 2016/08/24 08:28:42 UTC

Spark MLlib:Collaborative Filtering

Hi all,
I am newbie in collaborative filtering.I want to implement collaborative
filtering algorithm(need to find top 10 recommended products) using Spark
and Scala.I have a rating dataset where userID & ProductID are String type.

UserID                   ProductID             Rating
b3a68043-c1      p1-160ff5fDS-f74           1
b3a68043-c2      p5-160ff5fDS-f74           1
b3a68043-c0      p9-160ff5fDS-f74           1


I tried ALS algorithm using spark MLlib.But it support rating userID &
productID only Integer type.How can I solve this problem?

Thanks In Advance

Re: Spark MLlib:Collaborative Filtering

Posted by "Devi P.V" <de...@gmail.com>.
Thanks a lot.I solved the problem using string indexer.

On Wed, Aug 24, 2016 at 3:40 PM, Praveen Devarao <pr...@in.ibm.com>
wrote:

> You could use the string indexer to convert your string userids and
> product ids numeric value. http://spark.apache.org/docs/
> latest/ml-features.html#stringindexer
>
> Thanking You
> ------------------------------------------------------------
> ---------------------
> Praveen Devarao
> IBM India Software Labs
> ------------------------------------------------------------
> ---------------------
> "Courage doesn't always roar. Sometimes courage is the quiet voice at the
> end of the day saying I will try again"
>
>
>
> From:        glen <cn...@126.com>
> To:        "Devi P.V" <de...@gmail.com>
> Cc:        "user@spark.apache.org" <us...@spark.apache.org>
> Date:        24/08/2016 02:10 pm
> Subject:        Re: Spark MLlib:Collaborative Filtering
> ------------------------------
>
>
>
> Hash it to int
>
>
>
> On 2016-08-24 16:28 , *Devi P.V* <de...@gmail.com> Wrote:
>
> Hi all,
> I am newbie in collaborative filtering.I want to implement collaborative
> filtering algorithm(need to find top 10 recommended products) using Spark
> and Scala.I have a rating dataset where userID & ProductID are String type.
>
> UserID                   ProductID             Rating
> b3a68043-c1      p1-160ff5fDS-f74           1
> b3a68043-c2      p5-160ff5fDS-f74           1
> b3a68043-c0      p9-160ff5fDS-f74           1
>
>
> I tried ALS algorithm using spark MLlib.But it support rating userID &
> productID only Integer type.How can I solve this problem?
>
> Thanks In Advance
>
>
>
>
>

Re: Spark MLlib:Collaborative Filtering

Posted by Praveen Devarao <pr...@in.ibm.com>.
You could use the string indexer to convert your string userids and 
product ids numeric value. 
http://spark.apache.org/docs/latest/ml-features.html#stringindexer

Thanking You
---------------------------------------------------------------------------------
Praveen Devarao
IBM India Software Labs
---------------------------------------------------------------------------------
"Courage doesn't always roar. Sometimes courage is the quiet voice at the 
end of the day saying I will try again"



From:   glen <cn...@126.com>
To:     "Devi P.V" <de...@gmail.com>
Cc:     "user@spark.apache.org" <us...@spark.apache.org>
Date:   24/08/2016 02:10 pm
Subject:        Re: Spark MLlib:Collaborative Filtering



Hash it to int



On 2016-08-24 16:28 , Devi P.V Wrote: 

Hi all,
I am newbie in collaborative filtering.I want to implement collaborative 
filtering algorithm(need to find top 10 recommended products) using Spark 
and Scala.I have a rating dataset where userID & ProductID are String 
type.

UserID                   ProductID             Rating
b3a68043-c1      p1-160ff5fDS-f74           1
b3a68043-c2      p5-160ff5fDS-f74           1
b3a68043-c0      p9-160ff5fDS-f74           1


I tried ALS algorithm using spark MLlib.But it support rating userID & 
productID only Integer type.How can I solve this problem?

Thanks In Advance






Re: Spark MLlib:Collaborative Filtering

Posted by glen <cn...@126.com>.
Hash it to int




On 2016-08-24 16:28 , Devi P.V Wrote:


Hi all,
I am newbie in collaborative filtering.I want to implement collaborative filtering algorithm(need to find top 10 recommended products) using Spark and Scala.I have a rating dataset where userID & ProductID are String type.

UserID                   ProductID             Rating
b3a68043-c1      p1-160ff5fDS-f74           1
b3a68043-c2      p5-160ff5fDS-f74           1
b3a68043-c0      p9-160ff5fDS-f74           1


I tried ALS algorithm using spark MLlib.But it support rating userID & productID only Integer type.How can I solve this problem?


Thanks In Advance