mahout-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steven Bourke <sbou...@gmail.com>
Subject Re: FW: Mahout - Help needed - files with no preferences and integarting mahout with Hadoop
Date Fri, 12 Nov 2010 10:28:16 GMT
Try using the generic boolean pref user based recommender instead of the
generic user based recommender when using binary data.

http://mahout.apache.org/javadoc/core/org/apache/mahout/cf/taste/impl/recommender/GenericBooleanPrefUserBasedRecommender.html



On Fri, Nov 12, 2010 at 9:57 AM, bejoy ks <bejoyks@hotmail.com> wrote:

>
>
>
>
>
>
>
>
>
> Hi Mahout Experts,
>
>
> I'm totally new into mahout and badly indeed of some expert opinions. I
> wanted
> to implement a recommendation engine using mahout and hadoop, as the
> initial
> stage I just tried a recommender class with mahout alone which worked
> fine . I’m
> using eclipse for my development and to test I just ran the code from my
> eclipse like a simple java class with the required jars already added on
>  to project build path. The code I used for testing User Similarity
> recommendation is as follows
>
>
>
>
>
> public static void main(String[] args) throws TasteException
> {
>
>
>
>
>
>            String recsFile="D://mahoutFiles//SampleData.txt";
>
>
>            int
> neighbourhoodSize=7;
>
>
>            long
> ssoId=206008129;
>
>
>            int
> noOfRecommendations=5;
>
>
>            try {
>
>
>                  FileDataModel
> dataModel = new FileDataModel(new File(recsFile));
>
>
>                  UserSimilarity
> userSimilarity = new PearsonCorrelationSimilarity(dataModel);
>
>
>                  UserNeighborhood
> neighborhood =new NearestNUserNeighborhood(neighbourhoodSize,
> userSimilarity,
> dataModel);
>
>
>                  Recommender
> recommender =new GenericUserBasedRecommender(dataModel, neighborhood,
> userSimilarity);
>
>
>                  List<RecommendedItem>
> recommendations =recommender.recommend(ssoId, noOfRecommendations);
>
>
>                  for
> (RecommendedItem recommendedItem : recommendations) {
>
>
>                        System.out.println(recommendedItem.getItemID());
>
>
>                        System.out.print(" Item:
> "+dataModel.getItemIDAsString(recommendedItem.getItemID()));
>
>
>                        System.out.println(" and
> value: "+recommendedItem.getValue());
>
>
>                  }
>
>
>            } catch (IOException e)
> {
>
>
>                  e.printStackTrace();
>
>
>            } catch (TasteException
> e) {
>
>
>                  e.printStackTrace();
>
>
>            }
>
>
>
>
>
>      }
>
>
> The code I used for testing Item Similarity recommendation is as follows
>
> public static void main(String[] args) {
>
>        String recsFile="D://mahoutFiles//SampleData.txt";
>
>        long ssoId=206008129;
>
>        int noOfRecommendations=5;
>
>        String itemId="GE-CORPPROG-IMLP-PTOOLS";
>
>        try {
>
>            //item similarity recommendation based on User
>
>            FileDataModel dataModel = new FileDataModel(new File(recsFile));
>
>            ItemSimilarity itemSimilarity = new
> LogLikelihoodSimilarity(dataModel);
>
>            ItemBasedRecommender recommender =new
> GenericItemBasedRecommender(dataModel, itemSimilarity);
>
>            List<RecommendedItem> recommendations
> =recommender.recommend(ssoId, noOfRecommendations);
>
>
>
>            for (RecommendedItem recommendedItem : recommendations) {
>
>                System.out.println(recommendedItem);
>
>             }
>
>
>
>
>
>            //item similarity recommendation based on item
>
>            recommender =new GenericItemBasedRecommender(dataModel,
> itemSimilarity);
>
>            recommendations=
> recommender.mostSimilarItems(dataModel.readItemIDFromString(itemId),
> noOfRecommendations);
>
>            System.out.println("Item recommendations based on Item");
>
>            for (RecommendedItem recommendedItem : recommendations) {
>
>                System.out.println(recommendedItem);
>
>              }
>
>        } catch (IOException e) {
>
>            // TODO Auto-generated catch block
>
>            e.printStackTrace();
>
>        } catch (TasteException e) {
>
>            // TODO Auto-generated catch block
>
>            e.printStackTrace();
>
>        }
>
>
>
>    }
>
>
> The issues or concerns I have are as follows.
>
>
>
> Problem 1:
>
>
> This code produces relevant
> recommendations when I have given my file in the format <User id>, <item
> id>, <preference value>.
> But in my actual sample file I have just the user id and Item id alone, no
> preference value. On my reference since it is kind of a Boolean preference,
> I tried
> using PearsonCorrelationSimilarity
> as well as TanimotoCoefficientSimilarity but it is not giving me any
> recommendations. My actual file format that I'd want to process would be in
> the format <user id>,
> <item id>, . I can see it is processing all users in my file( from my
> eclipse console logs) but no recommendations are being produced as output.
>
>
>
>
>
> Problem 2:
>
>
>                I
> want to use my mahout recommender in Hadoop distributed environment. I
> don’t have
> a clue about it. I tried web help but most blogs refer me to
> org.apache.mahout.cf.taste.hadoop.item.RecommenderJob,
>  the code
> available with mahout src. Unfortunately I’m not able to get much from
> the code
> as it is a bit complicated for a starter like me. (I have done a couple
> of Map reduce project on text files processing before ). Could someone
> please help me
> out with  very basic simple code snippets to run my User Similarity and
> Item Similarity Recommendation code
> on hadoop environment .
>
>
>
>
>
>  It would be much
> helpful if you could share me with some informative tutorials which
> could make my initial steps in Mahout comfortable  before i could start
> exploring in
> depth.
>
>
>
>
>
> Thank you
>
>
>
>
> Thanks and Regards
>        Bejoy.K.S
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message