Package org.apache.mahout.cf.taste.similarity

Examples of org.apache.mahout.cf.taste.similarity.UserSimilarity.userSimilarity()


    UserSimilarity userSimilarityImpl = getUserSimilarity();
   
    while (usersIterable.hasNext()) {
      long otherUserID = usersIterable.next();
      if (userID != otherUserID) {
        double theSimilarity = userSimilarityImpl.userSimilarity(userID, otherUserID);
        if (!Double.isNaN(theSimilarity) && (theSimilarity >= threshold)) {
          neighborhood.add(otherUserID);
        }
      }
    }
View Full Code Here


    UserSimilarity userSimilarityImpl = getUserSimilarity();
   
    while (usersIterable.hasNext()) {
      long otherUserID = usersIterable.next();
      if (userID != otherUserID) {
        double theSimilarity = userSimilarityImpl.userSimilarity(userID, otherUserID);
        if (!Double.isNaN(theSimilarity) && (theSimilarity >= threshold)) {
          neighborhood.add(otherUserID);
        }
      }
    }
View Full Code Here

    boolean foundAPref = false;
    for (long userID : theNeighborhood) {
      // See GenericItemBasedRecommender.doEstimatePreference() too
      if ((userID != theUserID) && (dataModel.getPreferenceValue(userID, itemID) != null)) {
        foundAPref = true;
        totalSimilarity += similarity.userSimilarity(theUserID, userID);
      }
    }
    return foundAPref ? totalSimilarity : Float.NaN;
  }
 
View Full Code Here

    UserSimilarity userSimilarityImpl = getUserSimilarity();

    while (users.hasNext()) {
      User user = users.next();
      if (sampleForUser() && !userID.equals(user.getID())) {
        double theSimilarity = userSimilarityImpl.userSimilarity(theUser, user);
        if (!Double.isNaN(theSimilarity) && theSimilarity >= threshold) {
          neighborhood.add(user);
        }
      }
    }
View Full Code Here

      @Override
      public void refresh(Collection<Refreshable> alreadyRefreshed) {
      }
    });

    assertEquals(-0.435285750066007, similarity.userSimilarity(1L, 2L), EPSILON);
  }

}
View Full Code Here

    boolean foundAPref = false;
    for (long userID : theNeighborhood) {
      // See GenericItemBasedRecommender.doEstimatePreference() too
      if (userID != theUserID && dataModel.getPreferenceValue(userID, itemID) != null) {
        foundAPref = true;
        totalSimilarity += (float) similarity.userSimilarity(theUserID, userID);
      }
    }
    return foundAPref ? totalSimilarity : Float.NaN;
  }
 
View Full Code Here

    UserSimilarity userSimilarityImpl = getUserSimilarity();
   
    while (usersIterable.hasNext()) {
      long otherUserID = usersIterable.next();
      if (userID != otherUserID) {
        double theSimilarity = userSimilarityImpl.userSimilarity(userID, otherUserID);
        if (!Double.isNaN(theSimilarity) && theSimilarity >= threshold) {
          neighborhood.add(otherUserID);
        }
      }
    }
View Full Code Here

    UserSimilarity userSimilarityImpl = getUserSimilarity();

    while (usersIterable.hasNext()) {
      long otherUserID = usersIterable.next();
      if (userID != otherUserID) {
        double theSimilarity = userSimilarityImpl.userSimilarity(userID, otherUserID);
        if (!Double.isNaN(theSimilarity) && theSimilarity >= threshold) {
          neighborhood.add(otherUserID);
        }
      }
    }
View Full Code Here

    for (long userID : theNeighborhood) {
      if (userID != theUserID) {
        // See GenericItemBasedRecommender.doEstimatePreference() too
        if (dataModel.getPreferenceValue(userID, itemID) != null) {
          foundAPref = true;
          totalSimilarity += similarity.userSimilarity(theUserID, userID);
        }
      }
    }
    return foundAPref ? totalSimilarity : Float.NaN;
  }
View Full Code Here

    boolean foundAPref = false;
    for (long userID : theNeighborhood) {
      // See GenericItemBasedRecommender.doEstimatePreference() too
      if (userID != theUserID && dataModel.getPreferenceValue(userID, itemID) != null) {
        foundAPref = true;
        totalSimilarity += similarity.userSimilarity(theUserID, userID);
      }
    }
    return foundAPref ? totalSimilarity : Float.NaN;
  }
 
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.