-col_names = df.sort_values('j').loc[:,['subreddit_j']].drop_duplicates()
-first_name = list(set(df.subreddit_i) - set(df.subreddit_j))[0]
-col_names = [first_name] + list(col_names.subreddit_j)
-mat = df.groupby('i').apply(zero_pad)
-mat.loc[n] = np.concatenate([np.zeros(n),np.ones(1)])
-mat = np.stack(mat)
+ n = df.shape[0]
+ mat = np.array(df.drop('subreddit',1),dtype=np.float64)
+ mat[range(n),range(n)] = 1
+ mat[mat > 1] = 1
+ dist = 2*np.arccos(mat)/np.pi
+ tsne_model = TSNE(2,learning_rate=750,perplexity=50,n_iter=10000,metric='precomputed',early_exaggeration=20,n_jobs=-1)
+ tsne_fit_model = tsne_model.fit(dist)