-
Notifications
You must be signed in to change notification settings - Fork 0
/
Test_MC_MKL_2.py
29 lines (24 loc) · 968 Bytes
/
Test_MC_MKL_2.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
#!/usr/bin/env python
import numpy as np
import sys
from class_tools import *
if __name__ == '__main__':
#datasets=['plant','psortPos', 'psortNeg', 'nonpl', 'sector', 'segment','vehicle','vowel','wine','dna','glass','iris', 'svmguide2','satimage', 'usps']
datasets=['iris']
C_list = np.logspace(-2, 12, 15, base=2)
for i in range(len(datasets)):
if datasets[i] in ['plant','psortPos', 'psortNeg', 'nonpl']:
file_type='4'
else:
file_type='5'
data_name = datasets[i]
mode='mcmkl2'
para_list=[C_list, data_name, mode, file_type]
C = get_best_para(para_list)
if file_type == '4':
data, label = loadFromMat(data_name)
accuracy = train_test(mode, data, label, C, data_name)
elif file_type == '5':
X, y = loadFromLibsvm(data_name)
accuracy = train_test(mode, X, y, C, data_name)
print("\n".join(str(item * 100) for item in accuracy))