Examples of sortByValueReversed()


Examples of org.apache.mahout.cf.taste.model.PreferenceArray.sortByValueReversed()

        }
       
        // List some most-preferred items that would count as (most) "relevant" results
        double theRelevanceThreshold = Double.isNaN(relevanceThreshold) ?
            computeThreshold(prefs) : relevanceThreshold;
        prefs.sortByValueReversed();
        for (int i = 0; (i < size) && (relevantItemIDs.size() < at); i++) {
          if (prefs.getValue(i) >= theRelevanceThreshold) {
            relevantItemIDs.add(prefs.getItemID(i));
          }
        }
View Full Code Here

Examples of org.apache.mahout.cf.taste.model.PreferenceArray.sortByValueReversed()

    writer.print(NUM_TOP_PREFERENCES);
    writer.println(" Preferences:");
    PreferenceArray rawPrefs = dataModel.getPreferencesFromUser(userID);
    int length = rawPrefs.length();
    PreferenceArray sortedPrefs = rawPrefs.clone();
    sortedPrefs.sortByValueReversed();
    // Cap this at NUM_TOP_PREFERENCES just to be brief
    int max = Math.min(NUM_TOP_PREFERENCES, length);
    for (int i = 0; i < max; i++) {
      Preference pref = sortedPrefs.get(i);
      writer.print(pref.getValue());
View Full Code Here

Examples of org.apache.mahout.cf.taste.model.PreferenceArray.sortByValueReversed()

        }

        // List some most-preferred items that would count as (most) "relevant" results
        double theRelevanceThreshold =
            Double.isNaN(relevanceThreshold) ? computeThreshold(prefs) : relevanceThreshold;
        prefs.sortByValueReversed();
        for (int i = 0; (i < size) && (relevantItemIDs.size() < at); i++) {
          if (prefs.getValue(i) >= theRelevanceThreshold) {
            relevantItemIDs.add(prefs.getItemID(i));
          }
        }
View Full Code Here

Examples of org.apache.mahout.cf.taste.model.PreferenceArray.sortByValueReversed()

    writer.print(NUM_TOP_PREFERENCES);
    writer.println(" Preferences:");
    PreferenceArray rawPrefs = dataModel.getPreferencesFromUser(userID);
    int length = rawPrefs.length();
    PreferenceArray sortedPrefs = rawPrefs.clone();
    sortedPrefs.sortByValueReversed();
    // Cap this at NUM_TOP_PREFERENCES just to be brief
    int max = Math.min(NUM_TOP_PREFERENCES, length);
    for (int i = 0; i < max; i++) {
      Preference pref = sortedPrefs.get(i);
      writer.print(pref.getValue());
View Full Code Here

Examples of org.apache.mahout.cf.taste.model.PreferenceArray.sortByValueReversed()

    LongPrimitiveIterator users = recommender.getDataModel().getUserIDs();
    while (users.hasNext()) {
      long userID = users.nextLong();
      List<RecommendedItem> recs1 = recommender.recommend(userID, model.getNumItems());
      PreferenceArray prefs2 = model.getPreferencesFromUser(userID);
      prefs2.sortByValueReversed();
      FastIDSet commonSet = new FastIDSet();
      long maxItemID = setBits(commonSet, recs1, samples);
      FastIDSet otherSet = new FastIDSet();
      maxItemID = Math.max(maxItemID, setBits(otherSet, prefs2, samples));
      int max = mask(commonSet, otherSet, maxItemID);
View Full Code Here

Examples of org.apache.mahout.cf.taste.model.PreferenceArray.sortByValueReversed()

    while (users.hasNext()) {
      long userID = users.nextLong();
      PreferenceArray prefs1 = model1.getPreferencesFromUser(userID);
      PreferenceArray prefs2 = model2.getPreferencesFromUser(userID);
      prefs1.sortByValueReversed();
      prefs2.sortByValueReversed();
      FastIDSet commonSet = new FastIDSet();
      long maxItemID = setBits(commonSet, prefs1, samples);
      FastIDSet otherSet = new FastIDSet();
      maxItemID = Math.max(maxItemID, setBits(otherSet, prefs2, samples));
      int max = mask(commonSet, otherSet, maxItemID);
View Full Code Here

Examples of org.apache.mahout.cf.taste.model.PreferenceArray.sortByValueReversed()

                                       int at,
                                       double relevanceThreshold,
                                       DataModel dataModel) throws TasteException {
    PreferenceArray prefs = dataModel.getPreferencesFromUser(userID);
    FastIDSet relevantItemIDs = new FastIDSet(at);
    prefs.sortByValueReversed();
    for (int i = 0; i < prefs.length() && relevantItemIDs.size() < at; i++) {
      if (prefs.getValue(i) >= relevanceThreshold) {
        relevantItemIDs.add(prefs.getItemID(i));
      }
    }
View Full Code Here

Examples of org.apache.mahout.cf.taste.model.PreferenceArray.sortByValueReversed()

    prefs.set(2, new GenericPreference(2L, 1L, 3.0f));
    prefs.sortByValue();
    assertEquals(2L, prefs.getUserID(0));
    assertEquals(1L, prefs.getUserID(1));
    assertEquals(3L, prefs.getUserID(2));
    prefs.sortByValueReversed();
    assertEquals(3L, prefs.getUserID(0));
    assertEquals(1L, prefs.getUserID(1));
    assertEquals(2L, prefs.getUserID(2));
  }
View Full Code Here

Examples of org.apache.mahout.cf.taste.model.PreferenceArray.sortByValueReversed()

    prefs.set(2, new GenericPreference(1L, 2L, 3.0f));
    prefs.sortByValue();
    assertEquals(2L, prefs.getItemID(0));
    assertEquals(1L, prefs.getItemID(1));
    assertEquals(3L, prefs.getItemID(2));
    prefs.sortByValueReversed();
    assertEquals(3L, prefs.getItemID(0));
    assertEquals(1L, prefs.getItemID(1));
    assertEquals(2L, prefs.getItemID(2));
  }
View Full Code Here

Examples of org.apache.mahout.cf.taste.model.PreferenceArray.sortByValueReversed()

    writer.print(NUM_TOP_PREFERENCES);
    writer.println(" Preferences:");
    PreferenceArray rawPrefs = dataModel.getPreferencesFromUser(userID);
    int length = rawPrefs.length();
    PreferenceArray sortedPrefs = rawPrefs.clone();
    sortedPrefs.sortByValueReversed();
    // Cap this at NUM_TOP_PREFERENCES just to be brief
    int max = Math.min(NUM_TOP_PREFERENCES, length);
    for (int i = 0; i < max; i++) {
      Preference pref = sortedPrefs.get(i);
      writer.print(pref.getValue());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.