You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@mahout.apache.org by Jiten Gore <ji...@gores.net> on 2014/07/10 20:25:12 UTC
Recommender question
Dear Mahout community,
I am running an item based recommender on Mahout and using the Amazon paradigm, consider that there are books - two classes of books, one (A) coded with +ve ID values and the other (B) with -ve values for ID.
I would like to see recommendations for A class books only out of those from class B. The user ratings structure is the same for both classes.
I will appreciate any pointers you might have.
Best,
Jiten
Sent from my iPhone
Re: Recommender question
Posted by Jiten Gore <ji...@gores.net>.
Thanks to you both, Peng/Pat.
Sure I can map them out. Not a problem. The issue is the output returns all the matches from within the same set. So while I am only interested in the inter-set comparison (A vs B), the output I get has only intra-set comparisons (A vs A and B vs B). Upon filtering, there is no entry left for the A vs B.
Sent from my iPad
> On Jul 10, 2014, at 7:44 PM, Pat Ferrel <pa...@gmail.com> wrote:
>
> Right, as Peng says IDs are the row and column numbers in the input matrix 0..n, 0..m You assign them by incrementing for each unique application specific id. Use a hashmap or databased to maintain your own mapping dictionary from your IDs below into and out of Mahout IDs. The matrix is users = rows, items = columns.
>
> So for a particular item in the A set you want to recommend something similar from the B set. You do this by creating an input set that meats the above needs for IDs, the preference can be your rating number but often translating that into a boolean is as good if not better. Either way is OK but no 0 or below number for preference. The ID will be for all users and for all books from either set.
>
> Then you want to ask the ItemBasesRecommender for
>
> List<RecommendedItem> mostSimilarItems(long itemID, int howMany) throws TasteException;
>
> Filter out any items you don’t want from the list and return the ones with the highest strength. Notice the itemID is the Mahout column number for the item in question. So if You were on an Amazon page for a book it would be the Mahout ID for the book the user was looking at. The results will be from A and B so filter the ones you don’t want.
>
>
>
>
> On Jul 10, 2014, at 7:11 PM, Peng Zhang <pz...@gmail.com> wrote:
>
> Jiten,
>
> User and Book ids should be 0,1,2 etc. Plz don't use negative integers.
>
> Since I don't understand +ve/-ve you mentioned, but if you know which books belong to class A/B, you can filter the output correlation matrix yourself to get what you want.
>
> Peng Zhang
>
> --
> Sent from my iPhone
>
>> On Jul 11, 2014, at 9:49 AM, "Jiten Gore" <ji...@gores.net> wrote:
>>
>> Thanks for your reply, Pat. Here's an illustration:
>>
>> The input set looks like this:
>> User Book Preference
>> 1 10 7
>> 2 10 4
>> 3 10 5
>> 1 15 3
>> 2 15 8
>> 3 15 4
>> 1 20 9
>> 2 20 2
>> 3 20 3
>> 1 -1 8
>> 2 -1 8
>> 3 -1 2
>> 1 -2 5
>> 2 -2 6
>> 3 -2 4
>> 1 -3 7
>> 2 -3 5
>> 3 -4 3
>> ...
>>
>> For this set for the books (+ve set) I am interested in only the
>> recommendations for the Books (-ve set)
>>
>> The desired output (the values are made up):
>> Book1 Book2 ρ-value
>> 10 -2 0.75
>> 10 -3 0.66
>> 10 -1 0.41
>> 15 -1 0.80
>> 15 -2 0.55
>> 15 -3 0.21
>> 20 -2 0.91
>> 20 -1 0.65
>> 20 -3 0.47
>>
>> Thus, I would *not* like to see the ones like these two:
>> 10 20 0.61
>> -1 -2 0.73
>>
>> Does this help in clarifying? And yes I am interested in Pearson correlation
>> and I am using Hadoop.
>>
>> Best,
>> Jiten
>>
>> -----Original Message-----
>> From: Pat Ferrel [mailto:pat.ferrel@gmail.com]
>> Sent: Thursday, July 10, 2014 1:42 PM
>> To: user@mahout.apache.org
>> Subject: Re: Recommender question
>>
>> Can you rephrase this "I would like to see recommendations for A class books
>> only out of those from class B."
>>
>>
>> On Jul 10, 2014, at 11:25 AM, Jiten Gore <ji...@gores.net> wrote:
>>
>> Dear Mahout community,
>>
>> I am running an item based recommender on Mahout and using the Amazon
>> paradigm, consider that there are books - two classes of books, one (A)
>> coded with +ve ID values and the other (B) with -ve values for ID.
>>
>> I would like to see recommendations for A class books only out of those from
>> class B. The user ratings structure is the same for both classes.
>>
>> I will appreciate any pointers you might have.
>>
>> Best,
>> Jiten
>>
>> Sent from my iPhone
>
>
Re: Recommender question
Posted by Pat Ferrel <pa...@gmail.com>.
Right, as Peng says IDs are the row and column numbers in the input matrix 0..n, 0..m You assign them by incrementing for each unique application specific id. Use a hashmap or databased to maintain your own mapping dictionary from your IDs below into and out of Mahout IDs. The matrix is users = rows, items = columns.
So for a particular item in the A set you want to recommend something similar from the B set. You do this by creating an input set that meats the above needs for IDs, the preference can be your rating number but often translating that into a boolean is as good if not better. Either way is OK but no 0 or below number for preference. The ID will be for all users and for all books from either set.
Then you want to ask the ItemBasesRecommender for
List<RecommendedItem> mostSimilarItems(long itemID, int howMany) throws TasteException;
Filter out any items you don’t want from the list and return the ones with the highest strength. Notice the itemID is the Mahout column number for the item in question. So if You were on an Amazon page for a book it would be the Mahout ID for the book the user was looking at. The results will be from A and B so filter the ones you don’t want.
On Jul 10, 2014, at 7:11 PM, Peng Zhang <pz...@gmail.com> wrote:
Jiten,
User and Book ids should be 0,1,2 etc. Plz don't use negative integers.
Since I don't understand +ve/-ve you mentioned, but if you know which books belong to class A/B, you can filter the output correlation matrix yourself to get what you want.
Peng Zhang
--
Sent from my iPhone
> On Jul 11, 2014, at 9:49 AM, "Jiten Gore" <ji...@gores.net> wrote:
>
> Thanks for your reply, Pat. Here's an illustration:
>
> The input set looks like this:
> User Book Preference
> 1 10 7
> 2 10 4
> 3 10 5
> 1 15 3
> 2 15 8
> 3 15 4
> 1 20 9
> 2 20 2
> 3 20 3
> 1 -1 8
> 2 -1 8
> 3 -1 2
> 1 -2 5
> 2 -2 6
> 3 -2 4
> 1 -3 7
> 2 -3 5
> 3 -4 3
> ...
>
> For this set for the books (+ve set) I am interested in only the
> recommendations for the Books (-ve set)
>
> The desired output (the values are made up):
> Book1 Book2 ρ-value
> 10 -2 0.75
> 10 -3 0.66
> 10 -1 0.41
> 15 -1 0.80
> 15 -2 0.55
> 15 -3 0.21
> 20 -2 0.91
> 20 -1 0.65
> 20 -3 0.47
>
> Thus, I would *not* like to see the ones like these two:
> 10 20 0.61
> -1 -2 0.73
>
> Does this help in clarifying? And yes I am interested in Pearson correlation
> and I am using Hadoop.
>
> Best,
> Jiten
>
> -----Original Message-----
> From: Pat Ferrel [mailto:pat.ferrel@gmail.com]
> Sent: Thursday, July 10, 2014 1:42 PM
> To: user@mahout.apache.org
> Subject: Re: Recommender question
>
> Can you rephrase this "I would like to see recommendations for A class books
> only out of those from class B."
>
>
> On Jul 10, 2014, at 11:25 AM, Jiten Gore <ji...@gores.net> wrote:
>
> Dear Mahout community,
>
> I am running an item based recommender on Mahout and using the Amazon
> paradigm, consider that there are books - two classes of books, one (A)
> coded with +ve ID values and the other (B) with -ve values for ID.
>
> I would like to see recommendations for A class books only out of those from
> class B. The user ratings structure is the same for both classes.
>
> I will appreciate any pointers you might have.
>
> Best,
> Jiten
>
> Sent from my iPhone
>
>
>
Re: Recommender question
Posted by Peng Zhang <pz...@gmail.com>.
Jiten,
User and Book ids should be 0,1,2 etc. Plz don't use negative integers.
Since I don't understand +ve/-ve you mentioned, but if you know which books belong to class A/B, you can filter the output correlation matrix yourself to get what you want.
Peng Zhang
--
Sent from my iPhone
> On Jul 11, 2014, at 9:49 AM, "Jiten Gore" <ji...@gores.net> wrote:
>
> Thanks for your reply, Pat. Here's an illustration:
>
> The input set looks like this:
> User Book Preference
> 1 10 7
> 2 10 4
> 3 10 5
> 1 15 3
> 2 15 8
> 3 15 4
> 1 20 9
> 2 20 2
> 3 20 3
> 1 -1 8
> 2 -1 8
> 3 -1 2
> 1 -2 5
> 2 -2 6
> 3 -2 4
> 1 -3 7
> 2 -3 5
> 3 -4 3
> ...
>
> For this set for the books (+ve set) I am interested in only the
> recommendations for the Books (-ve set)
>
> The desired output (the values are made up):
> Book1 Book2 ρ-value
> 10 -2 0.75
> 10 -3 0.66
> 10 -1 0.41
> 15 -1 0.80
> 15 -2 0.55
> 15 -3 0.21
> 20 -2 0.91
> 20 -1 0.65
> 20 -3 0.47
>
> Thus, I would *not* like to see the ones like these two:
> 10 20 0.61
> -1 -2 0.73
>
> Does this help in clarifying? And yes I am interested in Pearson correlation
> and I am using Hadoop.
>
> Best,
> Jiten
>
> -----Original Message-----
> From: Pat Ferrel [mailto:pat.ferrel@gmail.com]
> Sent: Thursday, July 10, 2014 1:42 PM
> To: user@mahout.apache.org
> Subject: Re: Recommender question
>
> Can you rephrase this "I would like to see recommendations for A class books
> only out of those from class B."
>
>
> On Jul 10, 2014, at 11:25 AM, Jiten Gore <ji...@gores.net> wrote:
>
> Dear Mahout community,
>
> I am running an item based recommender on Mahout and using the Amazon
> paradigm, consider that there are books - two classes of books, one (A)
> coded with +ve ID values and the other (B) with -ve values for ID.
>
> I would like to see recommendations for A class books only out of those from
> class B. The user ratings structure is the same for both classes.
>
> I will appreciate any pointers you might have.
>
> Best,
> Jiten
>
> Sent from my iPhone
>
>
>
RE: Recommender question
Posted by Jiten Gore <ji...@gores.net>.
Thanks for your reply, Pat. Here's an illustration:
The input set looks like this:
User Book Preference
1 10 7
2 10 4
3 10 5
1 15 3
2 15 8
3 15 4
1 20 9
2 20 2
3 20 3
1 -1 8
2 -1 8
3 -1 2
1 -2 5
2 -2 6
3 -2 4
1 -3 7
2 -3 5
3 -4 3
...
For this set for the books (+ve set) I am interested in only the
recommendations for the Books (-ve set)
The desired output (the values are made up):
Book1 Book2 ρ-value
10 -2 0.75
10 -3 0.66
10 -1 0.41
15 -1 0.80
15 -2 0.55
15 -3 0.21
20 -2 0.91
20 -1 0.65
20 -3 0.47
Thus, I would *not* like to see the ones like these two:
10 20 0.61
-1 -2 0.73
Does this help in clarifying? And yes I am interested in Pearson correlation
and I am using Hadoop.
Best,
Jiten
-----Original Message-----
From: Pat Ferrel [mailto:pat.ferrel@gmail.com]
Sent: Thursday, July 10, 2014 1:42 PM
To: user@mahout.apache.org
Subject: Re: Recommender question
Can you rephrase this "I would like to see recommendations for A class books
only out of those from class B."
On Jul 10, 2014, at 11:25 AM, Jiten Gore <ji...@gores.net> wrote:
Dear Mahout community,
I am running an item based recommender on Mahout and using the Amazon
paradigm, consider that there are books - two classes of books, one (A)
coded with +ve ID values and the other (B) with -ve values for ID.
I would like to see recommendations for A class books only out of those from
class B. The user ratings structure is the same for both classes.
I will appreciate any pointers you might have.
Best,
Jiten
Sent from my iPhone
Re: Recommender question
Posted by Pat Ferrel <pa...@gmail.com>.
Can you rephrase this "I would like to see recommendations for A class books only out of those from class B.”
On Jul 10, 2014, at 11:25 AM, Jiten Gore <ji...@gores.net> wrote:
Dear Mahout community,
I am running an item based recommender on Mahout and using the Amazon paradigm, consider that there are books - two classes of books, one (A) coded with +ve ID values and the other (B) with -ve values for ID.
I would like to see recommendations for A class books only out of those from class B. The user ratings structure is the same for both classes.
I will appreciate any pointers you might have.
Best,
Jiten
Sent from my iPhone