parse_copenhagen: Working only with ego
This commit is contained in:
parent
a0f2708cdb
commit
70525a5ae6
@ -123,7 +123,7 @@ def main(args):
|
||||
Get users' landmarks
|
||||
'''
|
||||
# Get all users
|
||||
usrs = np.unique(np.concatenate((cont_data[:, uid_a], cont_data[:, uid_b]), 0))
|
||||
usrs = np.unique(cont_data[:, uid_a])
|
||||
# Check each user
|
||||
goal = [.2, .4, .6, .8]
|
||||
# Get users' data from previous parsing
|
||||
@ -135,7 +135,7 @@ def main(args):
|
||||
print('Checking %d (%d%%: %d/%d)... ' %(usr, (usr_i + 1)*100/len(usrs), usr_i + 1, len(usrs)), end='', flush=True)
|
||||
usrs_expt_cur = []
|
||||
# User's contacts
|
||||
usr_cont = cont_data[(cont_data[:, uid_a] == usr) | (cont_data[:, uid_b] == usr)]
|
||||
usr_cont = cont_data[cont_data[:, uid_a] == usr]
|
||||
# For each goal
|
||||
for_expt = True
|
||||
for g in goal:
|
||||
@ -152,7 +152,7 @@ def main(args):
|
||||
# Remove from user contacts
|
||||
usr_cont_cur = np.copy(usr_cont)
|
||||
for pos_c in pos_cont:
|
||||
usr_cont_cur = usr_cont_cur[(usr_cont_cur[:, uid_a] != pos_c) & (usr_cont_cur[:, uid_b] != pos_c)]
|
||||
usr_cont_cur = usr_cont_cur[usr_cont_cur[:, uid_a] != pos_c]
|
||||
# Compare the difference
|
||||
diff = (len(usr_cont) - len(usr_cont_cur))/len(usr_cont)
|
||||
# Check if it is close enough to what we need
|
||||
@ -167,12 +167,14 @@ def main(args):
|
||||
print('[NOK]')
|
||||
for_expt = False
|
||||
break
|
||||
# This user is no bueno
|
||||
print('[NOK]')
|
||||
# Save to results
|
||||
lmdk_lib.save_data(args, np.array(usrs_expt, str), 'usrs_expt')
|
||||
# Get all users
|
||||
# usrs = np.unique(usrs_expt[:, 0])
|
||||
# for usr in usrs:
|
||||
# usr_cont = cont_data[(cont_data[:, uid_a] == float(usr)) | (cont_data[:, uid_b] == float(usr))]
|
||||
# usr_cont = cont_data[cont_data[:, uid_a] == float(usr)]
|
||||
# print(int(usr), len(usr_cont))
|
||||
# exit()
|
||||
'''
|
||||
@ -181,7 +183,7 @@ def main(args):
|
||||
'''
|
||||
usr = '14'
|
||||
# All user contacts
|
||||
usr_cont = cont_data[(cont_data[:, uid_a] == float(usr)) | (cont_data[:, uid_b] == float(usr))]
|
||||
usr_cont = cont_data[cont_data[:, uid_a] == float(usr)]
|
||||
# All user landmarks for different goals
|
||||
usr_lmdk = usrs_expt[usrs_expt[:, 0] == usr]
|
||||
for g in goal:
|
||||
@ -190,7 +192,7 @@ def main(args):
|
||||
usr_cont_cur = np.copy(usr_cont)
|
||||
# Remove goal landmarks from contacts
|
||||
for c in cont:
|
||||
usr_cont_cur = usr_cont_cur[(usr_cont_cur[:, uid_a] != c) & (usr_cont_cur[:, uid_b] != c)]
|
||||
usr_cont_cur = usr_cont_cur[usr_cont_cur[:, uid_a] != c]
|
||||
# Check
|
||||
print(g, (len(usr_cont) - len(usr_cont_cur))/len(usr_cont))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user