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

Examples of org.apache.mahout.cf.taste.impl.model.GenericDataModel


    prefsForUser1.setItemID(1, 102L);
    prefsForUser1.setValue(1, 4.5f);

    preferences.put(1L, prefsForUser1);

    DataModel model = new GenericDataModel(preferences);
    System.out.println(model);
  }
View Full Code Here


      if (random.nextDouble() < evaluationPercentage) {
        processOneUser(trainingPercentage, trainingUsers, testUserPrefs, userID, dataModel);
      }
    }
   
    DataModel trainingModel = dataModelBuilder == null ? new GenericDataModel(trainingUsers)
        : dataModelBuilder.buildDataModel(trainingUsers);
   
    Recommender recommender = recommenderBuilder.buildRecommender(trainingModel);
   
    double result = getEvaluation(testUserPrefs, recommender);
View Full Code Here

          while (it2.hasNext()) {
            processOtherUser(userID, relevantItemIDs, trainingUsers, it2
                .nextLong(), dataModel);
          }
         
          DataModel trainingModel = dataModelBuilder == null ? new GenericDataModel(trainingUsers)
              : dataModelBuilder.buildDataModel(trainingUsers);
          Recommender recommender = recommenderBuilder.buildRecommender(trainingModel);
         
          try {
            trainingModel.getPreferencesFromUser(userID);
View Full Code Here

      }
      if (!prefsList.isEmpty()) {
        result.put(userIDs[i], new GenericUserPreferenceArray(prefsList));
      }
    }
    return new GenericDataModel(result);
  }
View Full Code Here

      for (int j = 0; j < numPrefs; j++) {
        prefs.set(j, new GenericPreference(i, random.nextInt(NUM_ITEMS), random.nextFloat()));
      }
      data.put(i, prefs);
    }
    return new GenericDataModel(data);
  }
View Full Code Here

  @Override
  protected DataModel buildModel() throws IOException {
    FastByIDMap<Collection<Preference>> data = new FastByIDMap<Collection<Preference>>();
    FileLineIterator iterator = new FileLineIterator(getDataFile(), false);
    processFile(iterator, data, false);
    return new GenericDataModel(GenericDataModel.toDataMap(data, true));
  }
View Full Code Here

   
    log.info("Reading preference data...");
    FastByIDMap<PreferenceArray> users = readUsers(dataDirectory);
   
    log.info("Creating delegate DataModel...");
    delegate = new GenericDataModel(users);
  }
View Full Code Here

       
        for (File updateFile : findUpdateFiles()) {
          processFile(new FileLineIterator(updateFile, false), data, false);
        }
       
        return new GenericDataModel(GenericDataModel.toDataMap(data, true));
       
      } else {
       
        FastByIDMap<PreferenceArray> rawData = ((GenericDataModel) delegate).getRawUserData();
       
        for (File updateFile : findUpdateFiles()) {
          processFile(new FileLineIterator(updateFile, false), rawData, true);
        }
       
        return new GenericDataModel(rawData);
       
      }
     
    } else {
     
View Full Code Here

    FastByIDMap<PreferenceArray> userData = new FastByIDMap<PreferenceArray>();
    userData.put(123L, new GenericUserPreferenceArray(prefsOfUser123));
    userData.put(456L, new GenericUserPreferenceArray(prefsOfUser456));
    userData.put(789L, new GenericUserPreferenceArray(prefsOfUser789));

    DataModel dataModel = new GenericDataModel(userData);

    CandidateItemsStrategy strategy = new SamplingCandidateItemsStrategy(1, 1);

    FastIDSet candidateItems = strategy.getCandidateItems(123L, dataModel);
    /* result can be either item2 or item3 or empty */
 
View Full Code Here

          while (it2.hasNext()) {
            processOtherUser(userID, relevantItemIDs, trainingUsers, it2
                .nextLong(), dataModel);
          }

          DataModel trainingModel = dataModelBuilder == null ? new GenericDataModel(trainingUsers)
              : dataModelBuilder.buildDataModel(trainingUsers);
          Recommender recommender = recommenderBuilder.buildRecommender(trainingModel);

          try {
            trainingModel.getPreferencesFromUser(userID);
View Full Code Here

TOP

Related Classes of org.apache.mahout.cf.taste.impl.model.GenericDataModel

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.