-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunExpLBP-paper.py
43 lines (30 loc) · 1.16 KB
/
runExpLBP-paper.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
import numpy as np
import matplotlib.pyplot as plt
import os
import sklearn.metrics as le_me
import utils
if __name__ == '__main__':
featFile = './res/feat-lbp-paper.npz'
# load features
assert (os.path.exists(featFile))
print('loading ', featFile)
fileDic = np.load(featFile)
# set up class names
usedClasses = ['Strata II - NSC', 'Codman-Hakim', 'Sophysa Polaris - SPV', 'Codman CERTAS', 'Miethke proGAV']
# Cross validation
X = fileDic['X']
y = fileDic['y']
yPredictionArr, yPredProbArr = utils.crossValidation(X, y)
# Compute confusion matrix
confMat = le_me.confusion_matrix(y, yPredictionArr)
accuracy = (np.trace(confMat)*1.0) / np.sum( confMat.flatten() )
print(le_me.classification_report(y, yPredictionArr, target_names=usedClasses))
# Compute confidence intervals
utils.bootStrapMetrics(y, yPredictionArr, dataRatio=0.8)
# Compute statistical significance
print('-'*20, 'One vs. all tests')
utils.classSigTests(y, yPredProbArr, usedClasses)
# # plot confusion matrix
# plt.figure()
# utils.plot_confusion_matrix(confMat, usedClasses, normalize=True )
# plt.show()