Custome metrics in Mahout Recommendation

2015-03-02 Thread Vikas Kumar
I am implementing recommendation techniques in Mahout. However, I have a
requirement for a custom evaluation metrics other than predefined or
built-in ones. So,

Q: Can someone please point me to sample custom Evaluator or metric
implementation in Mahout?


Thanks
Vikas


FPGrowth and Recommendations

2015-03-02 Thread Jeff Isenhart
Hi,
New to mahout and fp growth. I havefollowed this 
example:https://chimpler.wordpress.com/2013/05/02/finding-association-rules-with-mahout-frequent-pattern-mining/
I generated nice output informationlike this (as an example):
[abc,def,ghi] => klm,confidence:0.597, support:0.01, lift: 57.415, conviction: 
2.453…...

 Now I am not clear on how to model“recommendations” where given items [qrs, 
tuv] recommend wxy basedon confidence level. Am I to make lookups based on the 
above results or use one of the several recommender and similarity classesin 
mahout? A bit lost on where to start.
Thanks


Re: FPGrowth and Recommendations

2015-03-02 Thread Andrew Musselman
Hi Jeff, as I recall the map-reduce-based fp-growth solution was
problematic, and it's been either deprecated or removed.

There are better solutions under the "recommendations" tab at
http://mahout.apache.org

And I would encourage your updating your version of Mahout to 0.9 or to the
master branch at https://github.com/apache/mahout, since 0.7 from that blog
is outdated.

Best
Andrew

On Mon, Mar 2, 2015 at 3:26 PM, Jeff Isenhart 
wrote:

> Hi,
> New to mahout and fp growth. I havefollowed this example:
> https://chimpler.wordpress.com/2013/05/02/finding-association-rules-with-mahout-frequent-pattern-mining/
> I generated nice output informationlike this (as an example):
> [abc,def,ghi] => klm,confidence:0.597, support:0.01, lift: 57.415,
> conviction: 2.453…...
>
>  Now I am not clear on how to model“recommendations” where given items
> [qrs, tuv] recommend wxy basedon confidence level. Am I to make lookups
> based on the above results or use one of the several recommender and
> similarity classesin mahout? A bit lost on where to start.
> Thanks
>


Re: Custome metrics in Mahout Recommendation

2015-03-02 Thread Andrew Musselman
If you check out the latest master branch from
https://github.com/apache/mahout you'll find classes like this in the
map-reduce legacy
package:  
/home/akm/mahout/mrlegacy/src/main/java/org/apache/mahout/common/distance/CosineDistanceMeasure.java

I'm not sure if/where new ones are being written..

On Mon, Mar 2, 2015 at 3:12 PM, Vikas Kumar  wrote:

> I am implementing recommendation techniques in Mahout. However, I have a
> requirement for a custom evaluation metrics other than predefined or
> built-in ones. So,
>
> Q: Can someone please point me to sample custom Evaluator or metric
> implementation in Mahout?
>
>
> Thanks
> Vikas
>


Re: Custome metrics in Mahout Recommendation

2015-03-02 Thread Pat Ferrel
Evaluation metric? You mean like the old recommender evaluator? I’d use MAP 
mean average precision, but none are implemented in the new Spark recommender 
code. 

On Mar 2, 2015, at 3:12 PM, Vikas Kumar  wrote:

I am implementing recommendation techniques in Mahout. However, I have a
requirement for a custom evaluation metrics other than predefined or
built-in ones. So,

Q: Can someone please point me to sample custom Evaluator or metric
implementation in Mahout?


Thanks
Vikas



Re: Custome metrics in Mahout Recommendation

2015-03-02 Thread Vikas Kumar
Sorry for the confusion. Yes, I meant the recommender evaluation metric
such as RMSE, Precision, Recall etc which are inbuilt. But, I am planning
(or reusing - let me know if already done) to write the metrics such as
nDCG, Popularity, Avg. Rating, diversity etc.

Thanks
Vikas

On Mon, Mar 2, 2015 at 6:46 PM, Pat Ferrel  wrote:

> Evaluation metric? You mean like the old recommender evaluator? I’d use
> MAP mean average precision, but none are implemented in the new Spark
> recommender code.
>
> On Mar 2, 2015, at 3:12 PM, Vikas Kumar  wrote:
>
> I am implementing recommendation techniques in Mahout. However, I have a
> requirement for a custom evaluation metrics other than predefined or
> built-in ones. So,
>
> Q: Can someone please point me to sample custom Evaluator or metric
> implementation in Mahout?
>
>
> Thanks
> Vikas
>
>


Re: FPGrowth and Recommendations

2015-03-02 Thread Pat Ferrel
Jeff, are you trying to build a general recommender? Or a shopping cart 
recommender? FP was used to find things often bought together, which means 
recommendations based on some partial group of items (watchlist, wishlist, 
shopping cart). FPG has been deprecated in favor of newer methods.

There are references at the top of this page 
http://mahout.apache.org/users/recommender/intro-cooccurrence-spark.html that 
may help for a general recommender but things bought together would require a 
slightly different approach.

Think of the shopping-cart-id as if it were a user-id. Create a cooccurrence 
matrix using spark-itemsimilarity as described in the above references. The 
shopping cart ids will disappear leaving an item-id followed by a list of 
similar items. Index this in a search engine and use the current partial 
shopping cart as the query. You’ll get back an ordered list of the items most 
commonly bought with items in the current shopping cart.

On Mar 2, 2015, at 3:37 PM, Andrew Musselman  wrote:

Hi Jeff, as I recall the map-reduce-based fp-growth solution was
problematic, and it's been either deprecated or removed.

There are better solutions under the "recommendations" tab at
http://mahout.apache.org

And I would encourage your updating your version of Mahout to 0.9 or to the
master branch at https://github.com/apache/mahout, since 0.7 from that blog
is outdated.

Best
Andrew

On Mon, Mar 2, 2015 at 3:26 PM, Jeff Isenhart 
wrote:

> Hi,
> New to mahout and fp growth. I havefollowed this example:
> https://chimpler.wordpress.com/2013/05/02/finding-association-rules-with-mahout-frequent-pattern-mining/
> I generated nice output informationlike this (as an example):
> [abc,def,ghi] => klm,confidence:0.597, support:0.01, lift: 57.415,
> conviction: 2.453…...
> 
> Now I am not clear on how to model“recommendations” where given items
> [qrs, tuv] recommend wxy basedon confidence level. Am I to make lookups
> based on the above results or use one of the several recommender and
> similarity classesin mahout? A bit lost on where to start.
> Thanks
> 



Re: Custome metrics in Mahout Recommendation

2015-03-02 Thread Pat Ferrel
MAP is what I use, not precision. Mean average precision accounts for ranking 
better and ranking is usually what you want to optimize. As I said none are in 
the current iteration of the recommender code including RMSE, etc. 
http://mahout.apache.org/users/recommender/intro-cooccurrence-spark.html

What use did you have for offline metrics? No offline metric is as good as A/B 
testing. Often things built in to recommenders will lower one metric or another 
but produce better results in the form of user engagement or sales. Metrics 
must be used with great caution and should never be relied on in a real world 
situation where user testing is available.

On Mar 2, 2015, at 5:04 PM, Vikas Kumar  wrote:

Sorry for the confusion. Yes, I meant the recommender evaluation metric
such as RMSE, Precision, Recall etc which are inbuilt. But, I am planning
(or reusing - let me know if already done) to write the metrics such as
nDCG, Popularity, Avg. Rating, diversity etc.

Thanks
Vikas

On Mon, Mar 2, 2015 at 6:46 PM, Pat Ferrel  wrote:

> Evaluation metric? You mean like the old recommender evaluator? I’d use
> MAP mean average precision, but none are implemented in the new Spark
> recommender code.
> 
> On Mar 2, 2015, at 3:12 PM, Vikas Kumar  wrote:
> 
> I am implementing recommendation techniques in Mahout. However, I have a
> requirement for a custom evaluation metrics other than predefined or
> built-in ones. So,
> 
> Q: Can someone please point me to sample custom Evaluator or metric
> implementation in Mahout?
> 
> 
> Thanks
> Vikas
> 
> 



spark-itemsimilarity cross-indicator-matrix and indicator-matrix

2015-03-02 Thread Kevin Zhang
Hi Pat,

Thanks for the spark-itemsimilarity. I just ran it against my csv file which 
looks like below. My two actions are Liked and AddToCart. AddToCart is the main 
action.

usr000d3ca6655-c132-11e4-ac0a-0cc47a03334d Liked
prdb5bc44b-fca8-4462-ba19-b9b2b823beb6
usr000e615c7ff-c132-11e4-ac0a-0cc47a03334d   Liked
prd0002da21ddf-6004-4611-9ef5-4fe96bbb969f
usr000d4821d99-c132-11e4-ac0a-0cc47a03334d AddToCart   
prd75a5710-4890-4ec7-8faa-d9ffb0e94e6d
usr000cfd955f3-c132-11e4-ac0a-0cc47a03334d   Liked
prdb5bc44b-fca8-4462-ba19-b9b2b823beb6
usrdcd0443-c133-11e4-ac0a-0cc47a03334d Liked
prd000e8149493-f3a1-491c-abe1-e7886e0286b9
usr000dfc1e861-c132-11e4-ac0a-0cc47a03334d  Liked
prd0009d6ff4b1-b139-46de-8d4c-425dbee5b4ca
usr000d2db7271-c132-11e4-ac0a-0cc47a03334d Liked
prd000db1268fa-7fcb-4c84-8877-3b75f2748fda
usr000d274251f-c132-11e4-ac0a-0cc47a03334d  Liked
prd00078f2d7a1-9d6b-4175-96b5-d50ee35ab6db
usr000fb647da9-c132-11e4-ac0a-0cc47a03334d AddToCart 
prd000613c24dd-b838-433f-b1bc-e8e4dddae4d7
usr000d34d4713-c132-11e4-ac0a-0cc47a03334dLiked
prd0007ca32be4-2443-4bba-83b4-f01382968c07

I can see there are two output files. One is under cross-indicator-matrix  and 
the other under indicator-matrix.

I use Solr. I created a field called recommendation. It's indexed multivalues 
string field. I loaded indicator-matrix/part-0 into this filed.

My question is what is cross-indicator-matrix for? What's the difference 
between indicator-matrix and cross-indicator-matrix? Do I need to create 
another Solr field for this cross-indicator-matrix? When I should use it? Is 
indicator-matrix for AddToCart and cross-indicator-matrix for Liked?

Thanks a lot,
Kevin