Examples of NoSuchItemException


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

    } 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

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

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

    if (results[0].isEmpty()) {
      throw new NoSuchItemException(itemID1);
    }
    if (results[1].isEmpty()) {
      throw new NoSuchItemException(itemID2);
    }

    // First item
    Result result = results[0];
    SortedMap<byte[], byte[]> families = result.getFamilyMap(USERS_CF);
View Full Code Here

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

    if (useridx == null) {
      throw new NoSuchUserException();
    }
    Integer itemidx = itemMap.get(itemID);
    if (itemidx == null) {
      throw new NoSuchItemException();
    }
    return predictRating(useridx, itemidx);
  }
View Full Code Here

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

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

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

      rs = stmt.executeQuery();

      if (rs.next()) {
        return rs.getDouble(1);
      } else {
        throw new NoSuchItemException();
      }

    } catch (SQLException sqle) {
      log.warn("Exception while retrieving user", sqle);
      throw new TasteException(sqle);
View Full Code Here

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

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

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

    if (itemIDs.length == 0) {
      return 0;
    }
    FastIDSet userIDs = preferenceForItems.get(itemIDs[0]);
    if (userIDs == null) {
      throw new NoSuchItemException();
    }
    FastIDSet intersection = new FastIDSet(userIDs.size());
    intersection.addAll(userIDs);
    int i = 1;
    while (!intersection.isEmpty() && i < itemIDs.length) {
      userIDs = preferenceForItems.get(itemIDs[i]);
      if (userIDs == null) {
        throw new NoSuchItemException();
      }
      intersection.retainAll(userIDs);
      i++;
    }
    return intersection.size();
View Full Code Here

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

          anonymousUserFeatures[i] += (float) (signedFoldInWeight * userFoldIn[i]);
        }
      }
    }
    if (!anyItemIDFound) {
      throw new NoSuchItemException(Arrays.toString(itemIDs));
    }

    return anonymousUserFeatures;
  }
View Full Code Here

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

    } finally {
      yLock.unlock();
    }
   
    if (toItemFeatures == null) {
      throw new NoSuchItemException(toItemID);
    }
   
    float[] anonymousUserFeatures = buildAnonymousUserFeatures(itemIDs, values);   
   
    return (float) SimpleVectorMath.dot(anonymousUserFeatures, toItemFeatures);
View Full Code Here

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

    yLock.lock();
    try {

      float[] itemFeatures = Y.get(itemID);
      if (itemFeatures == null) {
        throw new NoSuchItemException(itemID);
      }

      return TopN.selectTopN(new MostSimilarItemIterator(Y.entrySet().iterator(),
                                                         generation.getUserTagIDs(),
                                                         new long[] { itemID },
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.