t-viSNE: Interactive Assessment and Interpretation of t-SNE Projections
https://doi.org/10.1109/TVCG.2020.2986996
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
544 B
23 lines
544 B
5 years ago
|
# first line: 123
|
||
|
def trustworthiness(D_high, D_low, k):
|
||
|
n = D_high.shape[0]
|
||
|
|
||
|
nn_orig = D_high.argsort()
|
||
|
nn_proj = D_low.argsort()
|
||
|
|
||
|
knn_orig = nn_orig[:, :k + 1][:, 1:]
|
||
|
knn_proj = nn_proj[:, :k + 1][:, 1:]
|
||
|
|
||
|
sum_i = 0
|
||
|
|
||
|
for i in range(n):
|
||
|
U = np.setdiff1d(knn_proj[i], knn_orig[i])
|
||
|
|
||
|
sum_j = 0
|
||
|
for j in range(U.shape[0]):
|
||
|
sum_j += np.where(nn_orig[i] == U[j])[0] - k
|
||
|
|
||
|
sum_i += sum_j
|
||
|
|
||
|
return float((1 - (2 / (n * k * (2 * n - 3 * k - 1)) * sum_i)).squeeze())
|