Skip to content

Instantly share code, notes, and snippets.

@ranman
Created July 20, 2011 05:29
Show Gist options
  • Save ranman/1094395 to your computer and use it in GitHub Desktop.
Save ranman/1094395 to your computer and use it in GitHub Desktop.
calc sims
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