Examples of sortByValue()


Examples of com.palmergames.util.KeyValueTable.sortByValue()

    table.put(4, 1);
   
    KeyValueTable kvTable = new KeyValueTable(table);
    print(kvTable);
    kvTable.sortByKey();print(kvTable);
    kvTable.sortByValue();print(kvTable);
  }
 
  public static void print(KeyValueTable<?,?> table) {
    for (KeyValue<?, ?> index : table.getKeyValues())
      System.out.print("[" + index.key + " : " + index.value + "]\n");
View Full Code Here

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

    xPrefs = xPrefs.clone();
    yPrefs = yPrefs.clone();
   
    // First sort by values from low to high
    xPrefs.sortByValue();
    yPrefs.sortByValue();
   
    // Assign ranks from low to high
    float nextRank = 1.0f;
    for (int i = 0; i < xLength; i++) {
      // ... but only for items that are common to both pref arrays
View Full Code Here

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

    xPrefs = xPrefs.clone();
    yPrefs = yPrefs.clone();
   
    // First sort by values from low to high
    xPrefs.sortByValue();
    yPrefs.sortByValue();
   
    // Assign ranks from low to high
    float nextRank = 1.0f;
    for (int i = 0; i < xLength; i++) {
      // ... but only for items that are common to both pref arrays
View Full Code Here

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

  public void testSortValue() {
    PreferenceArray prefs = new GenericItemPreferenceArray(3);
    prefs.set(0, new GenericPreference(3L, 1L, 5.0f));
    prefs.set(1, new GenericPreference(1L, 1L, 4.0f));
    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));
View Full Code Here

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

  public void testSortValue() {
    PreferenceArray prefs = new GenericUserPreferenceArray(3);
    prefs.set(0, new GenericPreference(1L, 3L, 5.0f));
    prefs.set(1, new GenericPreference(1L, 1L, 4.0f));
    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));
View Full Code Here

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

    xPrefs = xPrefs.clone();
    yPrefs = yPrefs.clone();
   
    // First sort by values from low to high
    xPrefs.sortByValue();
    yPrefs.sortByValue();
   
    // Assign ranks from low to high
    float nextRank = 1.0f;
    for (int i = 0; i < xLength; i++) {
      // ... but only for items that are common to both pref arrays
View Full Code Here

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

    xPrefs = xPrefs.clone();
    yPrefs = yPrefs.clone();

    // First sort by values from low to high
    xPrefs.sortByValue();
    yPrefs.sortByValue();

    // Assign ranks from low to high
    float nextRank = 1.0f;
    for (int i = 0; i < xLength; i++) {
      // ... but only for items that are common to both pref arrays
View Full Code Here

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

    xPrefs = xPrefs.clone();
    yPrefs = yPrefs.clone();
   
    // First sort by values from low to high
    xPrefs.sortByValue();
    yPrefs.sortByValue();
   
    // Assign ranks from low to high
    float nextRank = 1.0f;
    for (int i = 0; i < xLength; i++) {
      // ... but only for items that are common to both pref arrays
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.