Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dist = lambda a, b: len(list(a & b))
- row = []
- col = []
- data = []
- for i, a in enumerate(l):
- for j, b in enumerate(l):
- if i<j:
- d = dist(sample_dict[a], sample_dict[b])
- if d!=0:
- data.append(d)
- row.append(i)
- col.append(j)
- M = scipy.sparse.csc_matrix((data, (row, col)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement