-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvoting_each.py
32 lines (21 loc) · 975 Bytes
/
voting_each.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
import pandas as pd
method = ['bbgp', 'gcmh', 'ks']
shape = ['full', 'diag', 'spherical', 'tied', ]
evaluation = './1d_cutoff'
for i in range(1, 11):
labels = pd.DataFrame()
for m in method:
for s in shape:
PATH = './1d_split/em_1d_' + m + '_' + s + str(i) +'/em_2.csv'
OUTPUT = './1d_split/em_2_' + m + s + str(i) + '.csv'
preLabel = pd.read_csv(PATH, ',')
class_min = preLabel.groupby(['label'])[m.upper()].min()
class_min = class_min.sort_values(ascending=True).tolist()
j = 1
for cut in class_min:
preLabel.loc[preLabel[m.upper()] >= cut, 'label'] = 3-j
j += 1
labels['pos'] = preLabel['2L_POS']
labels[m+s] = preLabel['label']
#preLabel.to_csv(OUTPUT,index=False)
labels.to_csv('./1d_split/merging_em' + str(i) + '.csv', index= False)