You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by lk_spark <lk...@163.com> on 2017/03/16 01:32:15 UTC

how to call recommend method from ml.recommendation.ALS

hi,all:
       under spark2.0 ,I wonder to know after trained a ml.recommendation.ALSModel how I can do the recommend action?

       I try to save the model and load it by MatrixFactorizationModel but got error.

2017-03-16


lk_spark 

Re: Re: Re: how to call recommend method from ml.recommendation.ALS

Posted by lk_spark <lk...@163.com>.
Tank you , that's what I want to confirm.

2017-03-16 

lk_spark 



发件人:Yuhao Yang <hh...@gmail.com>
发送时间:2017-03-16 13:05
主题:Re: Re: how to call recommend method from ml.recommendation.ALS
收件人:"lk_spark"<lk...@163.com>
抄送:"任弘迪"<ry...@spark.apache.org>

This is something that was just added to ML and will probably be released with 2.2. For now you can try to copy from the master code: https://github.com/apache/spark/blob/70f9d7f71c63d2b1fdfed75cb7a59285c272a62b/mllib/src/main/scala/org/apache/spark/ml/recommendation/ALS.scala#L352 and give it a try.


Yuhao


2017-03-15 21:39 GMT-07:00 lk_spark <lk...@163.com>:

thanks for your reply , what I exactly want to know is :
in package mllib.recommendation  , MatrixFactorizationModel have method like recommendProducts , but I didn't find it in package ml.recommendation.
how can I do the samething as mllib when I use ml. 
2017-03-16 

lk_spark 



发件人:任弘迪 <ry...@gmail.com>
发送时间:2017-03-16 10:46
主题:Re: how to call recommend method from ml.recommendation.ALS
收件人:"lk_spark"<lk...@163.com>
抄送:"user.spark"<us...@spark.apache.org>

if the num of user-item pairs to predict aren't too large, say millions, you could transform the target dataframe and save the result to a hive table, then build cache based on that table for online services. 


if it's not the case(such as billions of user item pairs to predict), you have to start a service with the model loaded, send user to the service, first match several hundreds of items from all items available which could itself be another service or cache, then transform this user and all items using the model to get prediction, and return items ordered by prediction.


On Thu, Mar 16, 2017 at 9:32 AM, lk_spark <lk...@163.com> wrote:

hi,all:
       under spark2.0 ,I wonder to know after trained a ml.recommendation.ALSModel how I can do the recommend action?

       I try to save the model and load it by MatrixFactorizationModel but got error.

2017-03-16


lk_spark 

Re: Re: how to call recommend method from ml.recommendation.ALS

Posted by Yuhao Yang <hh...@gmail.com>.
This is something that was just added to ML and will probably be released
with 2.2. For now you can try to copy from the master code:
https://github.com/apache/spark/blob/70f9d7f71c63d2b1fdfed75cb7a59285c272a62b/mllib/src/main/scala/org/apache/spark/ml/recommendation/ALS.scala#L352
and give it a try.

Yuhao

2017-03-15 21:39 GMT-07:00 lk_spark <lk...@163.com>:

> thanks for your reply , what I exactly want to know is :
> in package mllib.recommendation  , MatrixFactorizationModel have method
> like recommendProducts , but I didn't find it in package ml.recommendation.
> how can I do the samething as mllib when I use ml.
> 2017-03-16
> ------------------------------
> lk_spark
> ------------------------------
>
> *发件人:*任弘迪 <ry...@gmail.com>
> *发送时间:*2017-03-16 10:46
> *主题:*Re: how to call recommend method from ml.recommendation.ALS
> *收件人:*"lk_spark"<lk...@163.com>
> *抄送:*"user.spark"<us...@spark.apache.org>
>
> if the num of user-item pairs to predict aren't too large, say millions,
> you could transform the target dataframe and save the result to a hive
> table, then build cache based on that table for online services.
>
> if it's not the case(such as billions of user item pairs to predict), you
> have to start a service with the model loaded, send user to the service,
> first match several hundreds of items from all items available which could
> itself be another service or cache, then transform this user and all items
> using the model to get prediction, and return items ordered by prediction.
>
> On Thu, Mar 16, 2017 at 9:32 AM, lk_spark <lk...@163.com> wrote:
>
>> hi,all:
>>        under spark2.0 ,I wonder to know after trained a
>> ml.recommendation.ALSModel how I can do the recommend action?
>>
>>        I try to save the model and load it by MatrixFactorizationModel
>> but got error.
>>
>> 2017-03-16
>> ------------------------------
>> lk_spark
>>
>
>

Re: Re: how to call recommend method from ml.recommendation.ALS

Posted by lk_spark <lk...@163.com>.
thanks for your reply , what I exactly want to know is :
in package mllib.recommendation  , MatrixFactorizationModel have method like recommendProducts , but I didn't find it in package ml.recommendation.
how can I do the samething as mllib when I use ml. 
2017-03-16 

lk_spark 



发件人:任弘迪 <ry...@gmail.com>
发送时间:2017-03-16 10:46
主题:Re: how to call recommend method from ml.recommendation.ALS
收件人:"lk_spark"<lk...@163.com>
抄送:"user.spark"<us...@spark.apache.org>

if the num of user-item pairs to predict aren't too large, say millions, you could transform the target dataframe and save the result to a hive table, then build cache based on that table for online services.


if it's not the case(such as billions of user item pairs to predict), you have to start a service with the model loaded, send user to the service, first match several hundreds of items from all items available which could itself be another service or cache, then transform this user and all items using the model to get prediction, and return items ordered by prediction.


On Thu, Mar 16, 2017 at 9:32 AM, lk_spark <lk...@163.com> wrote:

hi,all:
       under spark2.0 ,I wonder to know after trained a ml.recommendation.ALSModel how I can do the recommend action?

       I try to save the model and load it by MatrixFactorizationModel but got error.

2017-03-16


lk_spark 

Re: how to call recommend method from ml.recommendation.ALS

Posted by 任弘迪 <ry...@gmail.com>.
if the num of user-item pairs to predict aren't too large, say millions,
you could transform the target dataframe and save the result to a hive
table, then build cache based on that table for online services.

if it's not the case(such as billions of user item pairs to predict), you
have to start a service with the model loaded, send user to the service,
first match several hundreds of items from all items available which could
itself be another service or cache, then transform this user and all items
using the model to get prediction, and return items ordered by prediction.

On Thu, Mar 16, 2017 at 9:32 AM, lk_spark <lk...@163.com> wrote:

> hi,all:
>        under spark2.0 ,I wonder to know after trained a
> ml.recommendation.ALSModel how I can do the recommend action?
>
>        I try to save the model and load it by MatrixFactorizationModel but
> got error.
>
> 2017-03-16
> ------------------------------
> lk_spark
>