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

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


    userData.put(3L, new GenericUserPreferenceArray(Arrays.asList(new GenericPreference(3L, 2L, 5.0f),
        new GenericPreference(3L, 4L, 3.0f))));

    userData.put(4L, new GenericUserPreferenceArray(Arrays.asList(new GenericPreference(4L, 1L, 3.0f),
        new GenericPreference(4L, 4L, 5.0f))));
    dataModel = new GenericDataModel(userData);
  }
View Full Code Here


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

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

            mongoTimestamp = getDate(user.get("created_at"));
          }
        }
      }
    }
    delegate = new GenericDataModel(GenericDataModel.toDataMap(userIDPrefMap, true));
  }
View Full Code Here

            removeMongoUserItem(Long.toString(userID), Long.toString(itemID));
          }
        }
      }
    }
    return new GenericDataModel(rawData);
  }
View Full Code Here

                           Long.toString(itemID),
                           Float.toString(preferenceValue));
        }
      }
    }
    return new GenericDataModel(rawData);
  }
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, 1, dataModel.getNumUsers(), dataModel.getNumItems());

    FastIDSet candidateItems = strategy.getCandidateItems(123L, prefArrayOfUser123, dataModel);
    /* result can be either item2 or item3 or empty */
    assertTrue(candidateItems.size() <= 1);
    assertFalse(candidateItems.contains(1L));
View Full Code Here

      }

    }

    if (storeDates) {
      delegate = new GenericDataModel(userData, timestamps);
    } else {
      delegate = new GenericDataModel(userData);
    }

    Runtime runtime = Runtime.getRuntime();
    log.info("Loaded data model in about {}MB heap", (runtime.totalMemory() - runtime.freeMemory()) / 1000000);
  }
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

      }
      if (!prefsList.isEmpty()) {
        result.put(userIDs[i], new GenericUserPreferenceArray(prefsList));
      }
    }
    return new GenericDataModel(result);
  }
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.