+from pathlib import Path
+
+def read_similarity_mat(similarities, use_threads=True):
+ df = pd.read_feather(similarities, use_threads=use_threads)
+ mat = np.array(df.drop('_subreddit',1))
+ n = mat.shape[0]
+ mat[range(n),range(n)] = 1
+ return (df._subreddit,mat)
+
+def affinity_clustering(similarities, *args, **kwargs):
+ subreddits, mat = read_similarity_mat(similarities)
+ return _affinity_clustering(mat, subreddits, *args, **kwargs)