Package org.apache.mahout.cf.taste.common

Examples of org.apache.mahout.cf.taste.common.NoSuchItemException


        return newPreferenceArray;
      }
    }
    if (delegatePrefs == null) {
      // No, didn't find it among the anonymous user prefs
      throw new NoSuchItemException(itemID);
    }
    return delegatePrefs;
  }
View Full Code Here


 
  @Override
  public PreferenceArray getPreferencesForItem(long itemID) throws NoSuchItemException {
    FastIDSet userIDs = preferenceForItems.get(itemID);
    if (userIDs == null) {
      throw new NoSuchItemException(itemID);
    }
    PreferenceArray prefArray = new BooleanItemPreferenceArray(userIDs.size());
    int i = 0;
    LongPrimitiveIterator it = userIDs.iterator();
    while (it.hasNext()) {
View Full Code Here

  }

  public double[] getItemFeatures(long itemID) throws NoSuchItemException {
    Integer index = itemIDMapping.get(itemID);
    if (index == null) {
      throw new NoSuchItemException(itemID);
    }
    return itemFeatures[index];
  }
View Full Code Here

 
  @Override
  public PreferenceArray getPreferencesForItem(long itemID) throws NoSuchItemException {
    PreferenceArray prefs = preferenceForItems.get(itemID);
    if (prefs == null) {
      throw new NoSuchItemException(itemID);
    }
    return prefs;
  }
View Full Code Here

  @Override
  public PreferenceArray getPreferencesForItem(long itemID) throws TasteException {
    List<Preference> list = doGetPreferencesForItem(itemID);
    if (list.isEmpty()) {
      throw new NoSuchItemException(itemID);
    }
    return new GenericItemPreferenceArray(list);
  }
View Full Code Here

 
  @Override
  public PreferenceArray getPreferencesForItem(long itemID) throws NoSuchItemException {
    PreferenceArray prefs = preferenceForItems.get(itemID);
    if (prefs == null) {
      throw new NoSuchItemException(itemID);
    }
    return prefs;
  }
View Full Code Here

    public PreferenceArray get(Long itemID) throws TasteException {
      SliceQuery<Long,Long,Float> query = buildValueSliceQuery(ITEMS_CF);
      query.setKey(itemID);
      ColumnSlice<Long,Float> result = query.execute().get();
      if (result == null) {
        throw new NoSuchItemException(itemID);
      }
      List<HColumn<Long,Float>> userIDColumns = result.getColumns();
      if (userIDColumns.isEmpty()) {
        throw new NoSuchItemException(itemID);
      }
      int size = userIDColumns.size();
      PreferenceArray prefs = new GenericItemPreferenceArray(size);
      prefs.setItemID(0, itemID);
      for (int i = 0; i < size; i++) {
View Full Code Here

    public FastIDSet get(Long itemID) throws TasteException {
      SliceQuery<Long,Long,byte[]> query = buildNoValueSliceQuery(ITEMS_CF);
      query.setKey(itemID);
      ColumnSlice<Long,byte[]> result = query.execute().get();
      if (result == null) {
        throw new NoSuchItemException(itemID);
      }
      List<HColumn<Long,byte[]>> columns = result.getColumns();
      FastIDSet userIDs = new FastIDSet(columns.size());
      for (HColumn<Long,?> userIDColumn : columns) {
        userIDs.add(userIDColumn.getName());
View Full Code Here

    if (!add && !isIDInModel(userID)) {
      throw new NoSuchUserException();
    }
    for (List<String> item : items) {
      if (!add && !isIDInModel(item.get(0))) {
        throw new NoSuchItemException();
      }
    }
  }
View Full Code Here

    } catch (IOException e) {
      throw new TasteException("Failed to retrieve item preferences from HBase", e);
    }

    if (result.isEmpty()) {
      throw new NoSuchItemException(itemID);
    }

    SortedMap<byte[], byte[]> families = result.getFamilyMap(USERS_CF);
    PreferenceArray prefs = new GenericItemPreferenceArray(families.size());
    prefs.setItemID(0, itemID);
View Full Code Here

TOP

Related Classes of org.apache.mahout.cf.taste.common.NoSuchItemException

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.