2013-03-07 42 views

回答

2

import Orange, cPickle 
from Orange.classification import svm 

data = Orange.data.Table("2_new.tab") 
classifier = svm.LinearSVMLearner(data, folds=10) 
cPickle.dump(classifier, open("linear_svm.pck", "wb")) 

# later: 

classifier = cPickle.load(open('linear_svm.pck')) 
data_validation = Orange.data.Table('show.tab') 
print 'predictions:' 
for e in data_validation: 
    print e, "\t", classifier(e)