Open xiaomao19970819 opened 4 years ago
# DBSCAN cluster tri_mat = np.triu(rerank_dist, 1) # tri_mat.dim=2 tri_mat = tri_mat[np.nonzero(tri_mat)] # tri_mat.dim=1 tri_mat = np.sort(tri_mat,axis=None) top_num = np.round(args.rho*tri_mat.size).astype(int) eps = tri_mat[:top_num].mean() print('eps in cluster: {:.3f}'.format(eps)) cluster = DBSCAN(eps=eps,min_samples=4,metric='precomputed', n_jobs=8)
Why is it necessary to generate an upper triangular matrix when clustering