Mahout recommendation 10-Try grouplens Dataset

Source: Internet
Author: User

Dataset: The http://grouplens.org/datasets/movielens/ used kb before, now need to download movielens 10 m, use ratings. dat inside

Premise: because the file does not conform to the input format of the file in mahout, it needs to be converted. However, in example, grouplensdatamodel is a class for parsing the file, so it is used directly.

Package mahout; import Java. io. file; import Org. apache. mahout. cf. taste. common. tasteexception; import Org. apache. mahout. cf. taste. impl. eval. loadevaluator; import Org. apache. mahout. cf. taste. impl. neighborhood. nearestnuserneighborhood; import Org. apache. mahout. cf. taste. impl. recommender. genericuserbasedrecommender; import Org. apache. mahout. cf. taste. impl. similarity. pearsoncorrelationsimilarity; import Org. apache. mahout. cf. taste. model. datamodel; import Org. apache. mahout. cf. taste. neighborhood. userneighborhood; import Org. apache. mahout. cf. taste. recommender. recommender; import Org. apache. mahout. cf. taste. similarity. usersimilarity; import Org. apache. mahout. cf. taste. similarity. precompute. example. grouplensdatamodel; public class grouplensdatamodeltest {public static void main (string [] ARGs) throws exception {// use the custom grouplensdatamodel, if the dataset is not converted to a CSV format datamodel = new grouplensdatamodel (new file ("Data/ratings. data "); // Pearson correlation coefficient, measuring user similarity usersimilarity = new pearsoncorrelationsimilarity (datamodel); // building user neighbors, 100 userneighborhood = new neighbor (100, usersimilarity, datamodel); // recommender = new genericuserbasedrecommender (datamodel, userneighborhood, usersimilarity); // run loadevaluator. runload (recommender );}}

Run it, if your memory is large enough.

Output result:

My files have not been downloaded !!!!!!!!!!

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.