2016-01-06 14 views
1

我試圖用svm-train生成20個模型。該腳本工作並打印交叉驗證值,但不創建模型文件。我無法弄清楚爲什麼,有什麼想法?使用子進程運行libsvm不會創建模型

for i in range(1,21): 
    format_libsvm(data,"test",i) # create a data file called test 
    data = "test" 
    model = "model"+str(i) 
    batcmd = "./libsvm-3.21/svm-train -b 1 -v 10 "+data+".scale "+model 
    subprocess.call(batcmd, shell=True) 
    regex_CV = 'Cross Validation Accuracy = ([0-9\.]+)%' 
    result_re = re.search(regex_CV,result) 
    print (num2aa[i]+" "+result_re.group(1)) 

我真的很感謝您可以提供任何幫助。 「

回答

1

」交叉驗證用於選擇好的參數,找到它們後,您想要重新訓練整個數據,而不使用-v選項。「 csie.ntu.edu.tw/~cjlin/libsvm/faq.html#f501

這就是爲什麼我沒有模型文件。我的錯。