Package org.apache.mahout.cf.taste.impl.model.file

Examples of org.apache.mahout.cf.taste.impl.model.file.FileDataModel


    if( args.length > 0){
      INPUT_FILE = args[0];
    }
 
    UserSimilarity similarity;
    DataModel model = new FileDataModel(new File(INPUT_FILE));
   
   
    if( USE_LOG_LIKELIHOOD ){
      similarity =  new LogLikelihoodSimilarity(model);
    }
    else {
      similarity =  new TanimotoCoefficientSimilarity(model);
    }
    UserNeighborhood neighborhood = new NearestNUserNeighborhood(2, similarity, model);
    UserBasedRecommender recommender = new GenericUserBasedRecommender(model, neighborhood, similarity);
   
    int counter = 0;
    LongPrimitiveIterator users = model.getUserIDs();
    while (users.hasNext()) {
      long userID = users.nextLong();
      List<RecommendedItem> recommendations = recommender.recommend(userID, NUM_OF_RECOMMENDATIONS_RETURNED);
      for (RecommendedItem recommendation : recommendations) {
       
View Full Code Here


  private UserBaseRecommenderEvaluation() {}
 
  public static void main(String[] args) throws Exception {

  DataModel model = new FileDataModel(new File("ua.base.boolean-large.csv"));

  RecommenderBuilder builder = new RecommenderBuilder() {
    @Override
    public Recommender buildRecommender(DataModel model) throws TasteException {
      UserSimilarity similarity = new LogLikelihoodSimilarity(model);
View Full Code Here

  private ItemBaseRecommenderEvaluation() {}
 
  public static void main(String[] args) throws Exception {

  DataModel model = new FileDataModel(new File("ua.base.boolean.csv"));

  RecommenderBuilder builder = new RecommenderBuilder() {
    @Override
    public Recommender buildRecommender(DataModel model) throws TasteException {
      return new GenericBooleanPrefItemBasedRecommender(model, new LogLikelihoodSimilarity(model));
View Full Code Here

      INPUT_FILE = args[0];
      OUTPUT_FILE = args[1];
    }
 
    ItemSimilarity similarity;
    DataModel model = new FileDataModel(new File(INPUT_FILE));
    BufferedWriter out = new BufferedWriter(new FileWriter(OUTPUT_FILE));

 
 
    if( USE_LOG_LIKELIHOOD ){
      similarity =  new LogLikelihoodSimilarity(model);
    }
    else {
      similarity =  new TanimotoCoefficientSimilarity(model);
    }

    Recommender recommender = new GenericBooleanPrefItemBasedRecommender(model, similarity);
   
    int counter = 0;
    LongPrimitiveIterator users = model.getUserIDs();
    while (users.hasNext()) {
      long userID = users.nextLong();
      List<RecommendedItem> recommendations = recommender.recommend(userID, NUM_OF_RECOMMENDATIONS_RETURNED);
      for (RecommendedItem recommendation : recommendations) {
       
View Full Code Here

TOP

Related Classes of org.apache.mahout.cf.taste.impl.model.file.FileDataModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.