Skip to content

Commit

Permalink
update esim
Browse files Browse the repository at this point in the history
  • Loading branch information
lexin-chen committed May 2, 2024
1 parent c937074 commit 78a03be
Showing 1 changed file with 1 addition and 46 deletions.
47 changes: 1 addition & 46 deletions modules/esim.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,49 +452,4 @@ def calculate_comp_sim(data, c_threshold = None, n_ary = 'RR', w_factor = 'fract
SI = SimilarityIndex(obj, n_objects = n_objects - 1, n_ary = n_ary, w_factor = w_factor, weight = weight)
sim_index = SI()
total.append((i, sim_index))
return total

def real_var2_pre(data):
"""Pre-processing of normalized continuous data"""
c_total = np.sum(1 - np.abs(data - np.mean(data, axis=0)),axis=0)
return c_total

def sorted_comp_sim(data, c_threshold = None, n_ary = 'RR', w_factor = 'fraction', weight = 'nw', c_total = None):
total = calculate_comp_sim(data, c_threshold = c_threshold, n_ary = n_ary, w_factor = w_factor, weight = weight, c_total = c_total)
sort = sorted(total, key = lambda x: x[1])
return sort

#for m in [100000, 1000000, 10000000]:
# c_total = np.array(list(range(m)), dtype='float32')
# start = time.time()
# counters = calculate_counters(c_total, n_objects=2)
# t = time.time() - start
# print(t)

#data = np.array([[0,1,0,0,1,0],[1,0,1,1,0,1],[1,0,0,0,1,1],[1,1,0,1,1,1],[0,1,1,0,1,1]])

#fp_total = 10000
#fp_size = 100000
#data = np.random.randint(2, size=(fp_total, fp_size), dtype='int8')
#total_sum = np.sum(data, axis=0)
#
#old = 0
#
#if old:
# start = time.time()
# total = calculate_comp_sim(data, total_sum, c_threshold=None, n_ary = 'RR', weight = 'nw')
# t = time.time() - start
# print(t)
#else:
# start = time.time()
# total = calculate_comp_sim_rr(data, total_sum)
# t = time.time() - start
# print(t)
# print(total)

#dim = 100
#data = np.random.random((dim, dim))
#c_total = real_var2_pre(data)
#c_threshold = 0.56
#d = gen_sim_dict(c_total, dim, c_threshold=c_threshold)
#print(d['nw']['RR'])
return total

0 comments on commit 78a03be

Please sign in to comment.