Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- TP = 0.0
- FP = 0.0
- FN = 0.0
- TN = 0.0
- N = len(clusters)
- for i in range(N):
- for j in range(N):
- if i == j:
- continue
- if clusters[i] == clusters[j] and labels[i] == labels[j]:
- TP += 1
- if clusters[i] == clusters[j] and labels[i] != labels[j]:
- FP += 1
- if clusters[i] != clusters[j] and labels[i] == labels[j]:
- FN += 1
- if clusters[i] != clusters[j] and labels[i] != labels[j]:
- TN += 1
- return (TP + TN) / (TP + FP + FN + TN)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement