forked from wepe/PPD_RiskControlCompetition
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcal_mic.py
50 lines (34 loc) · 986 Bytes
/
cal_mic.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
"""
calculate the mic of two result
"""
import pandas as pd
import numpy as np
from minepy import MINE
xgb_7844 = pd.read_csv('xgb_7844.csv')
svm_771 = pd.read_csv('svm_771.csv')
xgb_787 = pd.read_csv('xgb_787.csv')
fs = ['xgb_7844','svm_771','xgb_787']
res = []
res.append(pd.read_csv('xgb_7844.csv').score.values)
res.append(pd.read_csv('svm_771.csv').score.values)
res.append(pd.read_csv('xgb_787.csv').score.values)
cm = []
for i in range(3):
tmp = []
for j in range(3):
m = MINE()
m.compute_score(res[i], res[j])
tmp.append(m.mic())
cm.append(tmp)
import numpy as np
import matplotlib.pyplot as plt
def plot_confusion_matrix(cm, title, cmap=plt.cm.Blues):
plt.imshow(cm, interpolation='nearest', cmap=cmap)
plt.title(title)
plt.colorbar()
tick_marks = np.arange(3)
plt.xticks(tick_marks, fs, rotation=45)
plt.yticks(tick_marks, fs)
plt.tight_layout()
plot_confusion_matrix(cm, title='mic')
plt.show()