-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmain.py
35 lines (29 loc) · 889 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"""
Experiment for AROC algorithm.
"""
import time
import scipy.io as sio
from aroc import aroc
from metrics import f1_score
def main():
"""
Main.
"""
# Load features
data = sio.loadmat('data/LightenedCNN_C_lfw.mat')
features = data['features']
labels = data['labels_original'][0]
label_lookup = {}
for idx, label in enumerate(labels):
label_lookup[idx] = int(label[0][:])
print('Features shape: ', features.shape)
start_time = time.time()
clusters = aroc(features, 200, 1.1, 12)
print('Time taken for clustering: {:.3f} seconds'.format(
time.time() - start_time))
_, _, _, precision, recall, score = f1_score(
clusters, label_lookup)
print('Clusters: {} Precision: {:.3f} Recall: {:.3f} F1: {:.3f}'.format(
len(clusters), precision, recall, score))
if __name__ == '__main__':
main()