Created
July 20, 2011 05:29
-
-
Save ranman/1094395 to your computer and use it in GitHub Desktop.
calc sims
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
venues = [] | |
others = [] | |
sims = [] | |
dictVenues = VenueToVenue.transformDict(user_ratings) | |
for venueID in dictVenues.keys(): | |
for otherID in dictVenues.keys(): | |
if otherID == venueID: | |
sim = 0 | |
else: | |
sim = dist_metric(dictVenues[venueID], dictVenues[otherID]) | |
if sim > 0: | |
venues.append(venueID) | |
others.append(otherID) | |
sims.append(sim) | |
tempsims = (venues, others, sims) | |
return coo_matrix((tempsims[2], (tempsims[0], tempsims[1]))).tolil() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment