pred_y = predict(train_label, train_sel_samp, c, g, test_label, test_sel_samp, 0, "%s.model"%train_sel_name)
from random import randrange
from datetime import datetime
is_win32 = (sys.platform == 'win32')
gridpy_exe = "./grid.py -log2c -2,9,2 -log2g 1,-11,-2"
svmtrain_exe="../svm-train"
svmpredict_exe="../svm-predict"
gridpy_exe = r".\grid.py -log2c -2,9,2 -log2g 1,-11,-2"
svmtrain_exe=r"..\windows\svmtrain.exe"
svmpredict_exe=r"..\windows\svmpredict.exe"
global train_pathfile, test_pathfile
global train_file, test_file
global svmtrain_exe, svmpredict_exe
if len(sys.argv) not in [2,3]:
print('Usage: %s training_file [testing_file]' % sys.argv[0])
train_pathfile=sys.argv[1]
assert os.path.exists(train_pathfile),"training file not found"
train_file = os.path.split(train_pathfile)[1]
test_pathfile=sys.argv[2]
assert os.path.exists(test_pathfile),"testing file not found"
test_file = os.path.split(test_pathfile)[1]
def feat_num_try_half(max_index):