Examples of intersectionSize()


Examples of org.apache.mahout.cf.taste.impl.common.FastIDSet.intersectionSize()

    FastIDSet prefs1 = dataModel.getItemIDsFromUser(userID1);
    FastIDSet prefs2 = dataModel.getItemIDsFromUser(userID2);
   
    int prefs1Size = prefs1.size();
    int prefs2Size = prefs2.size();
    int intersectionSize = prefs1Size < prefs2Size ? prefs2.intersectionSize(prefs1) : prefs1
        .intersectionSize(prefs2);
    if (intersectionSize == 0) {
      return Double.NaN;
    }
    int numItems = dataModel.getNumItems();
View Full Code Here

Examples of org.apache.mahout.cf.taste.impl.common.FastIDSet.intersectionSize()

    FastIDSet prefs1 = dataModel.getItemIDsFromUser(userID1);
    FastIDSet prefs2 = dataModel.getItemIDsFromUser(userID2);
   
    int prefs1Size = prefs1.size();
    int prefs2Size = prefs2.size();
    int intersectionSize = prefs1Size < prefs2Size ? prefs2.intersectionSize(prefs1) : prefs1
        .intersectionSize(prefs2);
    if (intersectionSize == 0) {
      return Double.NaN;
    }
    int numItems = dataModel.getNumItems();
View Full Code Here

Examples of org.apache.mahout.cf.taste.impl.common.FastIDSet.intersectionSize()

    FastIDSet userIDs2 = preferenceForItems.get(itemID2);
    if (userIDs2 == null) {
      return 0;
    }
    return userIDs1.size() < userIDs2.size()
        ? userIDs2.intersectionSize(userIDs1)
        : userIDs1.intersectionSize(userIDs2);
  }
 
  @Override
  public void removePreference(long userID, long itemID) {
View Full Code Here

Examples of org.apache.mahout.cf.taste.impl.common.FastIDSet.intersectionSize()

    if (xPrefsSize == 0 || yPrefsSize == 0) {
      return 0.0;
    }
   
    int intersectionSize =
        xPrefsSize < yPrefsSize ? yPrefs.intersectionSize(xPrefs) : xPrefs.intersectionSize(yPrefs);
    if (intersectionSize == 0) {
      return Double.NaN;
    }
   
    int unionSize = xPrefsSize + yPrefsSize - intersectionSize;
View Full Code Here

Examples of org.apache.mahout.cf.taste.impl.common.FastIDSet.intersectionSize()

    DataModel dataModel = getDataModel();
    FastIDSet prefs1 = dataModel.getItemIDsFromUser(userID1);
    FastIDSet prefs2 = dataModel.getItemIDsFromUser(userID2);
    int prefs1Size = prefs1.size();
    int prefs2Size = prefs2.size();
    int intersectionSize = prefs1Size < prefs2Size ? prefs2.intersectionSize(prefs1) : prefs1.intersectionSize(prefs2);
    return doSimilarity(prefs1Size, prefs2Size, intersectionSize);
  }

  /**
   * Calculate City Block Distance from total non-zero values and intersections and map to a similarity value.
View Full Code Here

Examples of org.apache.mahout.cf.taste.impl.common.FastIDSet.intersectionSize()

    FastIDSet prefs2 = dataModel.getItemIDsFromUser(userID2);
   
    long prefs1Size = prefs1.size();
    long prefs2Size = prefs2.size();
    long intersectionSize =
        prefs1Size < prefs2Size ? prefs2.intersectionSize(prefs1) : prefs1.intersectionSize(prefs2);
    if (intersectionSize == 0) {
      return Double.NaN;
    }
    long numItems = dataModel.getNumItems();
    double logLikelihood =
View Full Code Here

Examples of org.apache.mahout.cf.taste.impl.common.FastIDSet.intersectionSize()

  @Override
  public int getNumUsersWithPreferenceFor(long itemID1, long itemID2) throws TasteException {
    FastIDSet userIDs1 = userIDsFromItemCache.get(itemID1);
    FastIDSet userIDs2 = userIDsFromItemCache.get(itemID2);
    return userIDs1.size() < userIDs2.size()
        ? userIDs2.intersectionSize(userIDs1)
        : userIDs1.intersectionSize(userIDs2);
  }

  @Override
  public void setPreference(long userID, long itemID, float value) {
View Full Code Here

Examples of org.apache.mahout.cf.taste.impl.common.FastIDSet.intersectionSize()

    FastIDSet prefs2 = dataModel.getItemIDsFromUser(userID2);

    int prefs1Size = prefs1.size();
    int prefs2Size = prefs2.size();
    int intersectionSize = prefs1Size < prefs2Size ?
        prefs2.intersectionSize(prefs1) :
        prefs1.intersectionSize(prefs2);
    if (intersectionSize == 0) {
      return Double.NaN;
    }
    int numItems = dataModel.getNumItems();
View Full Code Here

Examples of org.apache.mahout.cf.taste.impl.common.FastIDSet.intersectionSize()

    FastIDSet prefs1 = dataModel.getItemIDsFromUser(userID1);
    FastIDSet prefs2 = dataModel.getItemIDsFromUser(userID2);
   
    int prefs1Size = prefs1.size();
    int prefs2Size = prefs2.size();
    int intersectionSize = prefs1Size < prefs2Size ? prefs2.intersectionSize(prefs1) : prefs1
        .intersectionSize(prefs2);
    if (intersectionSize == 0) {
      return Double.NaN;
    }
    int numItems = dataModel.getNumItems();
View Full Code Here

Examples of org.apache.mahout.cf.taste.impl.common.FastIDSet.intersectionSize()

    DataModel dataModel = getDataModel();
    FastIDSet prefs1 = dataModel.getItemIDsFromUser(userID1);
    FastIDSet prefs2 = dataModel.getItemIDsFromUser(userID2);
    int prefs1Size = prefs1.size();
    int prefs2Size = prefs2.size();
    int intersectionSize = prefs1Size < prefs2Size ? prefs2.intersectionSize(prefs1) : prefs1.intersectionSize(prefs2);
    return doSimilarity(prefs1Size, prefs2Size, intersectionSize);
  }

  /**
   * Calculate City Block Distance from total non-zero values and intersections and map to a similarity value.
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.