}
}
private void writeDebugRecommendations(long userID, Iterable<RecommendedItem> items, PrintWriter writer)
throws TasteException {
DataModel dataModel = recommender.getDataModel();
writer.print("User:");
writer.println(userID);
writer.print("Recommender: ");
writer.println(recommender);
writer.println();
writer.print("Top ");
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);