parse_copenhagen: Better results
This commit is contained in:
parent
bf06ddb187
commit
de18c09d13
@ -18,61 +18,22 @@ import zipfile
|
|||||||
|
|
||||||
'''
|
'''
|
||||||
usr n
|
usr n
|
||||||
109 6549
|
311 8193
|
||||||
112 3277
|
317 2044
|
||||||
113 4202
|
323 1642
|
||||||
139 8681
|
366 3406
|
||||||
14 9378
|
368 5099
|
||||||
145 4192
|
478 2616
|
||||||
147 4428
|
486 3112
|
||||||
157 11503
|
508 4981
|
||||||
164 8045
|
585 9443
|
||||||
17 4238
|
595 4459
|
||||||
176 19732
|
616 4355
|
||||||
178 7738
|
623 1586
|
||||||
186 3289
|
637 4479
|
||||||
190 13843
|
664 4315
|
||||||
216 6126
|
688 19728
|
||||||
236 3810
|
|
||||||
244 10563
|
|
||||||
262 17567
|
|
||||||
264 9792
|
|
||||||
274 11572
|
|
||||||
275 4316
|
|
||||||
287 13394
|
|
||||||
299 7373
|
|
||||||
304 6502
|
|
||||||
317 3892
|
|
||||||
324 11349
|
|
||||||
344 14479
|
|
||||||
374 5512
|
|
||||||
383 18751
|
|
||||||
389 3438
|
|
||||||
396 7004
|
|
||||||
453 3957
|
|
||||||
474 7692
|
|
||||||
480 4009
|
|
||||||
504 2622
|
|
||||||
505 11200
|
|
||||||
561 4304
|
|
||||||
570 2136
|
|
||||||
576 6553
|
|
||||||
58 12755
|
|
||||||
593 3429
|
|
||||||
595 4982
|
|
||||||
619 6189
|
|
||||||
633 5229
|
|
||||||
657 10941
|
|
||||||
658 1658
|
|
||||||
663 11461
|
|
||||||
688 19794
|
|
||||||
691 6755
|
|
||||||
705 5
|
705 5
|
||||||
76 4875
|
|
||||||
77 25
|
|
||||||
79 8892
|
|
||||||
81 8944
|
|
||||||
88 17254
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
# https://cloud.delkappa.com/s/ACMsDr2jnW3b6Np
|
# https://cloud.delkappa.com/s/ACMsDr2jnW3b6Np
|
||||||
@ -140,19 +101,18 @@ def main(args):
|
|||||||
for_expt = True
|
for_expt = True
|
||||||
for g in goal:
|
for g in goal:
|
||||||
if for_expt:
|
if for_expt:
|
||||||
|
# User's contacts
|
||||||
|
conts = np.unique(usr_cont[:, uid_b])
|
||||||
# Possible contacts
|
# Possible contacts
|
||||||
pos_cont = []
|
pos_cont = []
|
||||||
usrs_cur = list(usrs)
|
|
||||||
# Remove user
|
|
||||||
usrs_cur.remove(usr)
|
|
||||||
# Check for every possible contact
|
# Check for every possible contact
|
||||||
for u in usrs_cur:
|
for c in conts:
|
||||||
# Add possible contacts gradually
|
# Add possible contacts gradually
|
||||||
pos_cont.append(int(u))
|
pos_cont.append(int(c))
|
||||||
# Remove from user contacts
|
# Remove from user contacts
|
||||||
usr_cont_cur = np.copy(usr_cont)
|
usr_cont_cur = np.copy(usr_cont)
|
||||||
for pos_c in pos_cont:
|
for pos_c in pos_cont:
|
||||||
usr_cont_cur = usr_cont_cur[usr_cont_cur[:, uid_a] != pos_c]
|
usr_cont_cur = usr_cont_cur[usr_cont_cur[:, uid_b] != pos_c]
|
||||||
# Compare the difference
|
# Compare the difference
|
||||||
diff = (len(usr_cont) - len(usr_cont_cur))/len(usr_cont)
|
diff = (len(usr_cont) - len(usr_cont_cur))/len(usr_cont)
|
||||||
# Check if it is close enough to what we need
|
# Check if it is close enough to what we need
|
||||||
@ -164,24 +124,22 @@ def main(args):
|
|||||||
usrs_expt += usrs_expt_cur
|
usrs_expt += usrs_expt_cur
|
||||||
break
|
break
|
||||||
elif diff > g:
|
elif diff > g:
|
||||||
print('[NOK]')
|
print('[%.2f]' %(diff))
|
||||||
for_expt = False
|
for_expt = False
|
||||||
break
|
break
|
||||||
# This user is no bueno
|
|
||||||
print('[NOK]')
|
|
||||||
# Save to results
|
# Save to results
|
||||||
lmdk_lib.save_data(args, np.array(usrs_expt, str), 'usrs_expt')
|
lmdk_lib.save_data(args, np.array(usrs_expt, str), 'usrs_expt')
|
||||||
# Get all users
|
# # Get all users
|
||||||
# usrs = np.unique(usrs_expt[:, 0])
|
# usrs = np.unique(usrs_expt[:, 0])
|
||||||
# for usr in usrs:
|
# for usr in usrs:
|
||||||
# usr_cont = cont_data[cont_data[:, uid_a] == float(usr)]
|
# usr_cont = cont_data[cont_data[:, uid_a] == float(usr)]
|
||||||
# print(int(usr), len(usr_cont))
|
# print(int(usr), len(usr_cont))
|
||||||
# exit()
|
# exit()
|
||||||
'''
|
'''
|
||||||
Get contacts for user 14
|
Get contacts for user 623
|
||||||
9378 contacts
|
9378 contacts
|
||||||
'''
|
'''
|
||||||
usr = '14'
|
usr = '623'
|
||||||
# All user contacts
|
# All user contacts
|
||||||
usr_cont = cont_data[cont_data[:, uid_a] == float(usr)]
|
usr_cont = cont_data[cont_data[:, uid_a] == float(usr)]
|
||||||
# All user landmarks for different goals
|
# All user landmarks for different goals
|
||||||
@ -192,7 +150,7 @@ def main(args):
|
|||||||
usr_cont_cur = np.copy(usr_cont)
|
usr_cont_cur = np.copy(usr_cont)
|
||||||
# Remove goal landmarks from contacts
|
# Remove goal landmarks from contacts
|
||||||
for c in cont:
|
for c in cont:
|
||||||
usr_cont_cur = usr_cont_cur[usr_cont_cur[:, uid_a] != c]
|
usr_cont_cur = usr_cont_cur[usr_cont_cur[:, uid_b] != c]
|
||||||
# Check
|
# Check
|
||||||
print(g, (len(usr_cont) - len(usr_cont_cur))/len(usr_cont))
|
print(g, (len(usr_cont) - len(usr_cont_cur))/len(usr_cont))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user