mahout-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sean Owen <sro...@gmail.com>
Subject Re: BooleanTanimotoCoefficientSimilarity
Date Mon, 15 Jun 2009 13:54:02 GMT
Mahout's SVN repository should always be the latest. The Maven
repository represents the code as of the last official release. The
code block does not exist now in SVN (I think I took it out since it
was *really* that useful to check these things and was impacting
performance.)

On Mon, Jun 15, 2009 at 2:40 PM, Gökhan Çapan<gkhncpn@gmail.com> wrote:
> 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
View raw message