You will have to get the two user factor vectors from the ALS model and
compute the cosine similarity between them. You can do this using Breeze
vectors:

import breeze.linalg._
val user1 = new DenseVector[Double](userFactors.lookup("user1").head)
val user2 = new DenseVector[Double](userFactors.lookup("user2").head)
val sim = user1.t * user2 / (norm(user1)* norm(user2))


There is no built-in way currently to compute user or item similarities,
though there is a PR working on it:
https://github.com/apache/spark/pull/3536



On Sun, Apr 19, 2015 at 7:29 PM, Christian S. Perone <
christian.per...@gmail.com> wrote:

> The easiest way to do that is to use a similarity metric between the
> different user factors.
>
> On Sat, Apr 18, 2015 at 7:49 AM, riginos <samarasrigi...@gmail.com> wrote:
>
>> Is there any way that i can see the similarity table of 2 users in that
>> algorithm? by that i mean the similarity between 2 users
>>
>>
>>
>> --
>> View this message in context:
>> http://apache-spark-user-list.1001560.n3.nabble.com/MLlib-Collaborative-Filtering-tp22553.html
>> Sent from the Apache Spark User List mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscr...@spark.apache.org
>> For additional commands, e-mail: user-h...@spark.apache.org
>>
>>
>
>
> --
> Blog <http://blog.christianperone.com> | Github
> <https://github.com/perone> | Twitter <https://twitter.com/tarantulae>
> "Forgive, O Lord, my little jokes on Thee, and I'll forgive Thy great big
> joke on me."
>

Reply via email to