mahout-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gökhan Çapan <gkhn...@gmail.com>
Subject BooleanTanimotoCoefficientSimilarity
Date Mon, 15 Jun 2009 13:40:50 GMT
Hi,
BooleanTanimotoCoefficientSimilarity.userSimilarity(User user1, User user2)
that function is different in checked out code from svn repository and in
maven repository.
Which of those is latest code?

public double userSimilarity(User user1, User user2) {
   /*************************** This block does not exist in code that is
checked out from mahout's svn repository
    if (user1 == null || user2 == null) {
      throw new IllegalArgumentException("user1 or user2 is null");
    }
    if (!(user1 instanceof BooleanPrefUser && user2 instanceof
BooleanPrefUser)) {
      throw new IllegalArgumentException();
    }*************************/
    BooleanPrefUser<?> bpUser1 = (BooleanPrefUser<?>) user1;
    BooleanPrefUser<?> bpUser2 = (BooleanPrefUser<?>) user2;

    FastSet<Object> prefs1 = bpUser1.getItemIDs();
    FastSet<Object> prefs2 = bpUser2.getItemIDs();
    int intersectionSize =
        prefs1.size() < prefs2.size() ? prefs2.intersectionSize(prefs1) :
prefs1.intersectionSize(prefs2);

    int unionSize = prefs1.size() + prefs2.size() - intersectionSize;

    return (double) intersectionSize / (double) unionSize;
  }

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message