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

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


      FastByIDMap<Collection<Preference>> data = new FastByIDMap<Collection<Preference>>();
      processFile(iterator, data, delimiter);
      for (File updateFile : findUpdateFiles()) {
        processFile(new FileLineIterator(updateFile, false), data, delimiter);
      }
      return new GenericDataModel(GenericDataModel.toDataMap(data, true));
    } else {
      FastByIDMap<FastIDSet> data = new FastByIDMap<FastIDSet>();
      processFileWithoutID(iterator, data, delimiter);
      for (File updateFile : findUpdateFiles()) {
        processFileWithoutID(new FileLineIterator(updateFile, false), data, delimiter);
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, ',');
    return new GenericDataModel(GenericDataModel.toDataMap(data, true));
  }
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

        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

      LongPrimitiveIterator it2 = dataModel.getUserIDs();
      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 (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

    try {
      // Load new in-memory representation,
      log.info("Loading new JDBC delegate data...");
      DataModel newDelegateInMemory =
          delegate.hasPreferenceValues()
          ? new GenericDataModel(delegate.exportWithPrefs())
          : new GenericBooleanPrefDataModel(delegate.exportWithIDsOnly());
      // and then swap to it.
      log.info("New data loaded.");
      delegateInMemory = newDelegateInMemory;
    } catch (TasteException te) {
View Full Code Here

        for (File updateFile : findUpdateFilesAfter(newLastModified)) {
          processFile(new FileLineIterator(updateFile, false), data, timestamps, false);
        }

        return new GenericDataModel(GenericDataModel.toDataMap(data, true), timestamps);

      } else {

        FastByIDMap<PreferenceArray> rawData = ((GenericDataModel) delegate).getRawUserData();

        for (File updateFile : findUpdateFilesAfter(Math.max(oldLastUpdateFileModifieid, newLastModified))) {
          processFile(new FileLineIterator(updateFile, false), rawData, timestamps, true);
        }

        return new GenericDataModel(rawData, timestamps);

      }

    } else {
View Full Code Here

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

    FastByIDMap<PreferenceArray> userData = new FastByIDMap<PreferenceArray>();
    userData.put(123L, prefArrayOfUser123);
    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, prefArrayOfUser123, dataModel);
    /* result can be either item2 or item3 or empty */
 
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.